locale_form_language_admin_edit_form_alter

locale_form_language_admin_edit_form_alter(&$form, FormStateInterface $form_state)

Implements hook_form_FORM_ID_alter() for language_admin_edit_form().

File

core/modules/locale/locale.module, line 716
Enables the translation of the user interface to languages other than English.

Code

function locale_form_language_admin_edit_form_alter(&$form, FormStateInterface $form_state) {
  if ($form['langcode']['#type'] == 'value' && $form['langcode']['#value'] == 'en') {
    $form['locale_translate_english'] = array(
      '#title' => t('Enable interface translation to English'),
      '#type' => 'checkbox',
      '#default_value' => \Drupal::configFactory()->getEditable('locale.settings')->get('translate_english'),
    );
    $form['actions']['submit']['#submit'][] = 'locale_form_language_admin_edit_form_alter_submit';
  }
}
doc_Drupal
2016-10-29 09:24:15
Comments
Leave a Comment

Please login to continue.