You are here

function i18n_form_block_admin_display_form_submit in Internationalization 7

Display a help message when enabling the language switcher block.

1 string reference to 'i18n_form_block_admin_display_form_submit'
i18n_form_block_admin_display_form_alter in ./i18n.module
Implements hook_form_FORM_ID_alter().

File

./i18n.module, line 600
Internationalization (i18n) module.

Code

function i18n_form_block_admin_display_form_submit($form, &$form_state) {
  foreach ($form_state['values']['blocks'] as $key => $block) {
    $previous = $form['blocks'][$key]['region']['#default_value'];
    if (empty($previous) && $block['region'] != -1 && $block['module'] == 'locale') {
      $message = t('The language switcher will appear only after configuring <a href="!url">language detection</a>. You need to enable at least one method that alters URLs like <em>URL</em> or <em>Session</em>.', array(
        '!url' => url('admin/config/regional/language/configure'),
      ));
      drupal_set_message($message, 'warning', FALSE);
      break;
    }
  }
}