You are here

function lingotek_add_advanced_form in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.6 lingotek.module \lingotek_add_advanced_form()
1 call to lingotek_add_advanced_form()
lingotek_get_node_settings_form in ./lingotek.module
Display the Lingotek node-settings form

File

./lingotek.module, line 2501

Code

function lingotek_add_advanced_form($form, $form_state, $node) {
  $show_advanced = LingotekAccount::instance()
    ->showAdvanced();
  if ($show_advanced) {

    // Only show these options if the Lingotek document hasn't yet been created.
    if (!$node->lingotek['document_id'] && class_exists('LingotekApi')) {

      // Available projects.
      if ($projects = LingotekApi::instance()
        ->listProjects()) {
        $form['lingotek']['project_id'] = array(
          '#type' => 'select',
          '#title' => 'Project',
          '#description' => t('Select the translation project with which this item should be associated.'),
          '#default_value' => $node->lingotek['project_id'],
          '#options' => $projects,
        );
      }

      // Translation Memory (TM) Vault.
      if ($vaults = LingotekApi::instance()
        ->listVaults()) {
        $form['lingotek']['vault_id'] = array(
          '#type' => 'select',
          '#title' => t('TM Vault'),
          '#description' => t('Choose the TM vault to associate with this content item.'),
          '#default_value' => $node->lingotek['vault_id'],
          '#options' => $vaults,
        );
      }
    }

    // END:  Document not created yet
  }
  $form['lingotek']['content_end'] = array(
    '#markup' => '</div>',
  );
  $form['lingotek']['advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'developer_settings',
    '#access' => user_access('use lingotek developer tools'),
  );
  $form['lingotek']['advanced']['document_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Document Id'),
    '#description' => t("Read/Overwrite the document ID associated with the document.  This can break the translation process but can also be used to help figure out if something is wrong."),
    '#default_value' => $node->lingotek['document_id'],
  );
  $form['lingotek']['advanced']['current_lingonode'] = array(
    '#type' => 'textarea',
    '#title' => t('Node Data'),
    '#value' => !empty($node->nid) ? json_encode(lingotek_keystore('node', $node->nid)) : t('None'),
    '#disabled' => TRUE,
    '#attributes' => array(
      'rows' => '2',
    ),
  );
  return $form;
}