You are here

function tmgmt_entity_form_tmgmt_ui_entity_source_comment_overview_form_alter in Translation Management Tool 7

Implements hook_form_ID_alter().

Alters comment node type select box to filter out comment types that belongs to non entity translatable node types.

File

sources/entity/tmgmt_entity.module, line 35
Source plugin for the Translation Management system that handles entities.

Code

function tmgmt_entity_form_tmgmt_ui_entity_source_comment_overview_form_alter(&$form, &$form_state) {
  if (!isset($form['search_wrapper']['search']['node_type'])) {
    return;
  }

  // Change the select name to "type" as in the query submitted value will be
  // passed into node.type condition.
  $form['search_wrapper']['search']['type'] = $form['search_wrapper']['search']['node_type'];
  unset($form['search_wrapper']['search']['node_type']);

  // Set new default value.
  $form['search_wrapper']['search']['type']['#default_value'] = isset($_GET['type']) ? $_GET['type'] : NULL;
}