function locale_form_system_file_system_settings_alter

Same name and namespace in other branches
  1. 9 core/modules/locale/locale.module \locale_form_system_file_system_settings_alter()
  2. 8.9.x core/modules/locale/locale.module \locale_form_system_file_system_settings_alter()
  3. 10 core/modules/locale/locale.module \locale_form_system_file_system_settings_alter()

Implements hook_form_FORM_ID_alter() for system_file_system_settings().

Add interface translation directory setting to directories configuration.

File

core/modules/locale/locale.module, line 715

Code

function locale_form_system_file_system_settings_alter(&$form, FormStateInterface $form_state) {
    $form['translation_path'] = [
        '#type' => 'textfield',
        '#title' => t('Interface translations directory'),
        '#default_value' => \Drupal::configFactory()->getEditable('locale.settings')
            ->get('translation.path'),
        '#maxlength' => 255,
        '#description' => t('A local file system path where interface translation files will be stored.'),
        '#required' => TRUE,
        '#after_build' => [
            'system_check_directory',
        ],
        '#weight' => 10,
    ];
    if ($form['file_default_scheme']) {
        $form['file_default_scheme']['#weight'] = 20;
    }
    $form['#submit'][] = 'locale_system_file_system_settings_submit';
}

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