public function TMGMTI18nStringDefaultSourceUIController::overviewSearchFormPart in Translation Management Tool 7
Builds search form for entity sources overview.
Parameters
array $form: Drupal form array.
$form_state: Drupal form_state array.
$type: Entity type.
Return value
array Drupal form array.
1 call to TMGMTI18nStringDefaultSourceUIController::overviewSearchFormPart()
- TMGMTI18nStringDefaultSourceUIController::overviewForm in sources/
i18n_string/ tmgmt_i18n_string.ui.inc
File
- sources/
i18n_string/ tmgmt_i18n_string.ui.inc, line 127 - Provides the I18nString source controller.
Class
- TMGMTI18nStringDefaultSourceUIController
- Class TMGMTI18nStringDefaultSourceUIController
Code
public function overviewSearchFormPart($form, &$form_state, $type) {
$options = array();
foreach (language_list() as $langcode => $language) {
$options[$langcode] = $language->name;
}
$default_values = $this
->getSearchFormSubmittedParams();
$form['search_wrapper'] = array(
'#prefix' => '<div class="tmgmt-sources-wrapper tmgmt-i18n_string-sources-wrapper">',
'#suffix' => '</div>',
'#weight' => -15,
);
$form['search_wrapper']['search'] = array(
'#tree' => TRUE,
);
$form['search_wrapper']['search']['label'] = array(
'#type' => 'textfield',
'#title' => t('Label in source language'),
'#default_value' => isset($default_values['label']) ? $default_values['label'] : NULL,
);
// Unset the source language as it should not be listed among target
// languages.
unset($options[i18n_string_source_language()]);
$form['search_wrapper']['search']['target_language'] = array(
'#type' => 'select',
'#title' => t('Target language'),
'#options' => $options,
'#empty_option' => t('Any'),
'#default_value' => isset($default_values['target_language']) ? $default_values['target_language'] : NULL,
);
$form['search_wrapper']['search']['target_status'] = array(
'#type' => 'select',
'#title' => t('Target status'),
'#options' => array(
'untranslated_or_outdated' => t('Untranslated or outdated'),
'untranslated' => t('Untranslated'),
'outdated' => t('Outdated'),
),
'#default_value' => isset($default_values['target_status']) ? $default_values['target_status'] : NULL,
'#states' => array(
'invisible' => array(
':input[name="search[target_language]"]' => array(
'value' => '',
),
),
),
);
$form['search_wrapper']['search_submit'] = array(
'#type' => 'submit',
'#value' => t('Search'),
);
return $form;
}