function LocaleHooks::formLanguageAdminEditFormAlter

Implements hook_form_FORM_ID_alter() for language_admin_edit_form().

File

core/modules/locale/src/Hook/LocaleHooks.php, line 317

Class

LocaleHooks
Hook implementations for locale.

Namespace

Drupal\locale\Hook

Code

public function formLanguageAdminEditFormAlter(&$form, FormStateInterface $form_state) : void {
    if ($form['langcode']['#type'] == 'value' && $form['langcode']['#value'] == 'en') {
        $form['locale_translate_english'] = [
            '#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';
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.