You are here

function lingotek_setup_language_switcher_form in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.7 lingotek.setup.inc \lingotek_setup_language_switcher_form()
  2. 7.4 lingotek.setup.inc \lingotek_setup_language_switcher_form()
  3. 7.5 lingotek.setup.inc \lingotek_setup_language_switcher_form()
  4. 7.6 lingotek.setup.inc \lingotek_setup_language_switcher_form()
1 string reference to 'lingotek_setup_language_switcher_form'
lingotek_menu in ./lingotek.module
Implements hook_menu().

File

./lingotek.setup.inc, line 656

Code

function lingotek_setup_language_switcher_form($form, $form_state) {
  $current_theme = variable_get('theme_default', 'none');

  //global $theme_key;
  $query = db_select('block', 'b');
  $query
    ->fields('b');
  $query
    ->condition('module', 'locale');
  $query
    ->condition('delta', 'language');
  $query
    ->condition('theme', $current_theme);
  $result = $query
    ->execute();
  $block = $result
    ->fetchAssoc();
  $block_enabled = $block['status'];
  $block_regions = system_region_list($current_theme, REGIONS_VISIBLE);
  $default_region = "sidebar_first";
  $default_region_value = array_key_exists($block['region'], $block_regions) ? $block['region'] : (array_key_exists($default_region, $block_regions) ? $default_region : NULL);
  $form = array(
    '#type' => 'item',
    '#title' => t('Default Language Switcher'),
    'actions' => array(
      '#type' => 'actions',
      'submit' => array(
        '#type' => 'submit',
        '#value' => t('Next'),
      ),
      'lingotek_back_button' => lingotek_setup_link('admin/config/lingotek/language-settings', t('Previous Step')),
    ),
  );
  $_SESSION['lingotek_setup_path'][] = 'admin/config/lingotek/setup-language-switcher';
  $form['theme'] = array(
    '#type' => 'hidden',
    '#value' => $current_theme,
  );
  $form['enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable the default language switcher'),
    '#default_value' => TRUE,
  );
  $form['region'] = array(
    '#type' => 'select',
    '#title' => t('The region where the switcher will be displayed.'),
    '#options' => $block_regions,
    '#default_value' => $default_region_value,
    '#states' => array(
      'invisible' => array(
        ':input[name="enabled"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );

  //  $form['detection'] = array(
  //    '#type' => 'select',
  //    '#description' => t("How to decide which language is used to display pages"),
  //    '#options' => array('Session', 'URL'),
  //    '#states' => array(
  //      'invisible' => array(
  //        ':input[name="enabled"]' => array('checked' => FALSE),
  //      ),
  //    ),
  //  );
  $output = array(
    $form,
  );
  return $output;
}