locale_translation_filter_form

7 locale.admin.inc locale_translation_filter_form()
8 locale.pages.inc locale_translation_filter_form()

Return form for locale translation filters.

Related topics

1 string reference to 'locale_translation_filter_form'

File

modules/locale/locale.admin.inc, line 843
Administration functions for locale.module.

Code

function locale_translation_filter_form() {
  $filters = locale_translation_filters();

  $form['filters'] = array(
    '#type' => 'fieldset', 
    '#title' => t('Filter translatable strings'), 
    '#collapsible' => TRUE, 
    '#collapsed' => FALSE,
  );
  foreach ($filters as $key => $filter) {
    // Special case for 'string' filter.
    if ($key == 'string') {
      $form['filters']['status']['string'] = array(
        '#type' => 'textfield', 
        '#title' => $filter['title'], 
        '#description' => $filter['description'],
      );
    }
    else {
      $form['filters']['status'][$key] = array(
        '#title' => $filter['title'], 
        '#type' => 'select', 
        '#empty_value' => 'all', 
        '#empty_option' => $filter['options']['all'], 
        '#size' => 0, 
        '#options' => $filter['options'],
      );
    }
    if (!empty($_SESSION['locale_translation_filter'][$key])) {
      $form['filters']['status'][$key]['#default_value'] = $_SESSION['locale_translation_filter'][$key];
    }
  }

  $form['filters']['actions'] = array(
    '#type' => 'actions', 
    '#attributes' => array('class' => array('container-inline')),
  );
  $form['filters']['actions']['submit'] = array(
    '#type' => 'submit', 
    '#value' => t('Filter'),
  );
  if (!empty($_SESSION['locale_translation_filter'])) {
    $form['filters']['actions']['reset'] = array(
      '#type' => 'submit', 
      '#value' => t('Reset'),
    );
  }

  return $form;
}
Login or register to post comments