You are here

function lingotek_admin_utilities_form in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lingotek.admin.inc \lingotek_admin_utilities_form()
  2. 7.3 lingotek.admin.inc \lingotek_admin_utilities_form()
  3. 7.5 lingotek.admin.inc \lingotek_admin_utilities_form()
  4. 7.6 lingotek.admin.inc \lingotek_admin_utilities_form()

Utilities Form

1 string reference to 'lingotek_admin_utilities_form'
lingotek_admin_configuration_view in ./lingotek.admin.inc

File

./lingotek.admin.inc, line 1764

Code

function lingotek_admin_utilities_form($form, &$form_state, $show_fieldset = FALSE) {
  $form['utilities'] = array(
    '#type' => $show_fieldset ? 'fieldset' : 'item',
    '#title' => t('Utilities'),
    '#description' => '',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'additional_settings',
  );
  $btn_disassociate_translations = array(
    '#type' => 'submit',
    '#value' => t('Disassociate'),
    '#submit' => array(
      'lingotek_batch_disassociate_content',
    ),
    '#attributes' => array(
      'onclick' => 'return confirm("' . t('Are you sure?\\n\\nAll of your content will have to be retranslated.') . '");',
    ),
  );
  $btn_cleanup = array(
    '#type' => 'submit',
    '#value' => t('Cleanup'),
    '#submit' => array(
      'lingotek_cleanup_utility',
    ),
  );
  $btn_callback_url_update = array(
    '#type' => 'submit',
    '#value' => t('Update'),
    '#submit' => array(
      'lingotek_notify_url_update',
    ),
  );
  $btn_callback_refresh_api_cache = array(
    '#type' => 'submit',
    '#value' => t('Refresh'),
    '#submit' => array(
      'lingotek_refresh_api_cache',
    ),
  );

  // Start: Not sure why, but without these below, the table button do not work properly
  $form['utilities'][] = array_merge($btn_disassociate_translations, array(
    '#attributes' => array(
      'style' => 'display: none;',
    ),
  ));
  $form['utilities'][] = array_merge($btn_cleanup, array(
    '#attributes' => array(
      'style' => 'display: none;',
    ),
  ));
  $form['utilities'][] = array_merge($btn_callback_url_update, array(
    '#attributes' => array(
      'style' => 'display: none;',
    ),
  ));
  $form['utilities'][] = array_merge($btn_callback_refresh_api_cache, array(
    '#attributes' => array(
      'style' => 'display: none;',
    ),
  ));

  // End: Not sure why
  $rows = array(
    array(
      array(
        'data' => array(
          '#type' => 'markup',
          '#prefix' => t('Refresh Project, Workflow, and Vault Information') . '<div class="description">',
          '#markup' => t("This module locally caches the available projects, workflows, and vaults.  Use this utility whenever you need to pull down names for any newly created projects, workflows, or vaults from the Lingotek Translation Management System."),
          '#suffix' => '</div>',
        ),
      ),
      array(
        'data' => $btn_callback_refresh_api_cache,
      ),
    ),
    array(
      array(
        'data' => array(
          '#type' => 'markup',
          '#prefix' => t('Update Notification Callback URL') . '<div class="description">',
          '#markup' => t("Update the notification callback URL.  This can be run whenever your site is moved (e.g., domain name change or sub-directory re-location) or whenever you would like your security token re-generated.<br/>") . '<br/>' . t("Current notification callback URL:") . ' <i>' . variable_get('lingotek_notify_url', 'None') . '</i>',
          '#suffix' => '</div>',
        ),
      ),
      array(
        'data' => $btn_callback_url_update,
      ),
    ),
    array(
      array(
        'data' => array(
          '#type' => 'markup',
          '#prefix' => t('Cleanup and Identify Translatable Content') . '<div class="description">',
          '#markup' => t("The cleanup utility identifies translatable content and processes all existing data for translation-enabled fields on nodes, ensuring that if data was entered before enabling field translation on a field that the existing field data is copied over to the parent node's current language."),
          '#suffix' => '</div>',
        ),
      ),
      array(
        'data' => $btn_cleanup,
      ),
    ),
    array(
      array(
        'data' => array(
          '#type' => 'markup',
          '#prefix' => t('Disassociate All Translations') . ' <i>' . t('(use with caution)') . '</i>' . '<div class="description">',
          '#markup' => t("Should only be used to change the Lingotek project or TM vault associated with the node’s translation. Disassociates node translations on Lingotek’s servers from the copies downloaded to Drupal. Additional translation using Lingotek will require re-uploading the node’s content to restart the translation process."),
          '#suffix' => '</div>',
        ),
      ),
      array(
        'data' => $btn_disassociate_translations,
      ),
    ),
  );
  $header = array();
  $form['utilities']['utility_table'] = array(
    '#markup' => theme('table', array(
      'header' => $header,
      'rows' => $rows,
    )),
  );
  return $form;
}