You are here

function test_theme_settings_form_system_theme_settings_alter in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/themes/test_theme_settings/theme-settings.php \test_theme_settings_form_system_theme_settings_alter()
  2. 9 core/modules/system/tests/themes/test_theme_settings/theme-settings.php \test_theme_settings_form_system_theme_settings_alter()

Implements hook_form_system_theme_settings_alter().

File

core/modules/system/tests/themes/test_theme_settings/theme-settings.php, line 14
Test to ensure theme compatibility with managed files.

Code

function test_theme_settings_form_system_theme_settings_alter(&$form, FormStateInterface $form_state) {
  $form['custom_logo'] = [
    '#type' => 'managed_file',
    '#title' => t('Secondary logo.'),
    '#default_value' => theme_get_setting('custom_logo'),
    '#progress_indicator' => 'bar',
    '#progress_message' => t('Please wait...'),
    '#upload_location' => 'public://test',
    '#upload_validators' => [
      'file_validate_extensions' => [
        'gif png jpg jpeg',
      ],
    ],
  ];
  $form['multi_file'] = [
    '#type' => 'managed_file',
    '#title' => t('Multiple file field with all file extensions'),
    '#multiple' => TRUE,
    '#default_value' => theme_get_setting('multi_file'),
    '#upload_location' => 'public://test',
    '#upload_validators' => [
      'file_validate_extensions' => [],
    ],
  ];
  $form['#submit'][] = 'test_theme_settings_form_system_theme_settings_submit';
}