You are here

function lingotek_admin_cleanup_form in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.5 lingotek.admin.inc \lingotek_admin_cleanup_form()
  2. 7.6 lingotek.admin.inc \lingotek_admin_cleanup_form()

Utilities form.

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

File

./lingotek.admin.inc, line 2706

Code

function lingotek_admin_cleanup_form($form, &$form_state, $show_fieldset = FALSE) {
  $node_based_translation = variable_get('lingotek_nodes_translation_method') == 'node' ? TRUE : FALSE;
  $form['cleanup'] = array(
    '#type' => $show_fieldset ? 'fieldset' : 'item',
    '#title' => t('Multilingual Preparation Utilities'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'administrative_settings',
    'actions' => array(
      '#type' => 'actions',
      'submit' => array(
        '#type' => 'submit',
        '#value' => t('Run Selected Utilities'),
      ),
    ),
    '#submit' => array(
      'lingotek_admin_cleanup_form_submit',
    ),
  );
  $cleanup_function_headers = array(
    'title' => array(
      'data' => t('Utility'),
    ),
    'desc' => array(
      'data' => t('Description'),
    ),
  );
  $cleanup_functions = array();

  /* TEMPLATE
    $cleanup_functions['lingotek_cleanup_'] = array(
      'title' => t('title'),
      'desc' => t('description'),
    );
     * END TEMPLATE
     */
  $cleanup_functions['lingotek_batch_identify_translations'] = array(
    'title' => '<span style="white-space: nowrap">' . t('Identify existing translations') . '</span>',
    'desc' => t('Identifies existing node translations currently untracked by the Lingotek module. The translation status for all newly discovered translations will be set to <i>current</i>.'),
  );
  $cleanup_functions['lingotek_cleanup_field_languages_for_nodes'] = array(
    'title' => t('Prepare nodes'),
    'desc' => t('Sets all <i>language neutral</i> nodes (and underlying fields and path aliases) to be @lang.', array(
      '@lang' => language_default('name'),
    )),
  );
  if (module_exists('entity_translation')) {
    $cleanup_functions['lingotek_cleanup_notify_entity_translation'] = array(
      'title' => t('Sync with Entity Translation'),
      'desc' => t('Reports all translations managed by Lingotek to the Entity Translation module.'),
    );
  }
  if (module_exists('comment')) {
    $cleanup_functions['lingotek_cleanup_field_languages_for_comments'] = array(
      'title' => t('Prepare comments'),
      'desc' => t('Sets all <i>language neutral</i> comments (and underlying fields) to be @lang.', array(
        '@lang' => language_default('name'),
      )),
    );
  }
  if (module_exists('fieldable_panels_panes')) {
    $cleanup_functions['lingotek_cleanup_field_languages_for_fieldable_panels_panes'] = array(
      'title' => t('Prepare FPPs'),
      'desc' => t('Sets all <i>language neutral</i> fieldable panels panes (FPPs) to be @lang.', array(
        '@lang' => language_default('name'),
      )),
    );
  }
  if (module_exists('taxonomy') && variable_get('lingotek_advanced_taxonomy_terms', FALSE)) {
    $cleanup_functions['lingotek_cleanup_field_languages_for_taxonomy_terms'] = array(
      'title' => t('Prepare taxonomy terms with custom fields'),
      'desc' => t('Sets all <i>language neutral</i> taxonomy terms managed by Lingotek (and underlying fields) to be @lang.', array(
        '@lang' => language_default('name'),
      )),
    );
  }
  if (module_exists('bean') && variable_get('lingotek_translate_beans', FALSE)) {
    $cleanup_functions['lingotek_cleanup_field_languages_for_beans'] = array(
      'title' => t('Prepare bean fields'),
      'desc' => t('Sets all <i>language neutral</i> bean fields to be @lang.', array(
        '@lang' => language_default('name'),
      )),
    );
  }
  if (module_exists('group') && variable_get('lingotek_translate_groups', FALSE)) {
    $cleanup_functions['lingotek_cleanup_field_languages_for_groups'] = array(
      'title' => t('Prepare group fields'),
      'desc' => t('Sets all <i>language neutral</i> group fields to be @lang.', array(
        '@lang' => language_default('name'),
      )),
    );
  }
  if (module_exists('paragraphs') && variable_get('lingotek_translate_paragraphs', FALSE)) {
    $cleanup_functions['lingotek_cleanup_field_languages_for_paragraphs'] = array(
      'title' => t('Prepare paragraph fields'),
      'desc' => t('Sets all <i>language neutral</i> paragraph fields to be @lang.', array(
        '@lang' => language_default('name'),
      )),
    );
  }
  if (module_exists('commerce_product') && variable_get('lingotek_translate_commerce_product', FALSE)) {
    $cleanup_functions['lingotek_cleanup_field_languages_for_commerce_products'] = array(
      'title' => t('Prepare commerce products'),
      'desc' => t('Sets all <i>language neutral</i> commerce products (and underlying fields) to be @lang.', array(
        '@lang' => language_default('name'),
      )),
    );
  }
  $cleanup_functions['lingotek_admin_prepare_blocks'] = array(
    'title' => t('Prepare blocks'),
    'desc' => t('Update all blocks to be translatable in the <i>Languages</i> settings.'),
  );
  $cleanup_functions['lingotek_admin_prepare_taxonomies'] = array(
    'title' => t('Prepare taxonomy'),
    'desc' => t('Update all taxonomy vocabularies that are not currently enabled for multilingual to use translation mode <i>Localize</i> in the Multilingual Options. (Note: Translation mode <i>Localize</i> does not support translation of custom fields within taxonomy terms.)'),
  );
  $cleanup_functions['lingotek_admin_prepare_menus'] = array(
    'title' => t('Prepare menus'),
    'desc' => t('Update all menus to use <i>Translate and Localize</i> in the Multilingual Options, and update all menu links to be <i>Language neutral</i> only if advanced handling of menu links is off.'),
  );
  if (module_exists('field_collection')) {
    $extra_note = '';
    if (lingotek_has_unconventional_fc_translations()) {
      $extra_note = '<div style="color:red;">' . t('Note: It appears you have existing field collection translations that may not conform with Lingotek\'s method of translating field collections.  Using this utility will delete those translations.') . '</div>';
    }
    $cleanup_functions['lingotek_cleanup_field_collection_fields'] = array(
      'title' => t('Prepare field collections'),
      'desc' => t("Sets all field-collections to be <i>language neutral</i>, allowing the underlying fields to be enabled for multilingual use.  !note", array(
        '!note' => $extra_note,
      )),
    );
  }
  if (module_exists('message')) {
    $cleanup_functions['lingotek_cleanup_message_types'] = array(
      'title' => t('Prepare message types'),
      'desc' => t("Sets all empty and undefined languages associated with the Message API module to be the site-default language."),
    );
  }
  $cleanup_functions['lingotek_add_missing_locales'] = array(
    'title' => t('Add missing locales'),
    'desc' => t('Fills in any missing locale values to the <i>languages</i> table.'),
  );
  if (module_exists('entityreference') && $node_based_translation) {
    $cleanup_functions['lingotek_cleanup_entity_references'] = array(
      'title' => t('Correct translation entity references'),
      'desc' => t('Correct node-based entity references within translation entities. Include entities:') . '<div>
          <select name="ltk_entity_reference_date">
            <option value="1_day">Updated 1 day ago</option>
            <option value="30_days">Updated 30 days ago</option>
            <option value="90_days">Updated 90 days ago</option>
            <option value="all">All</option>
          </select>
        </div>',
    );
  }
  $form['cleanup']['grid'] = array(
    '#type' => 'tableselect',
    '#header' => $cleanup_function_headers,
    '#options' => $cleanup_functions,
  );
  $rows = array();
  $form['#action'] = url('admin/settings/lingotek/settings', array(
    'fragment' => 'ltk-utils',
  ));
  return $form;
}