function TestThemeSettingsHooks::submitForm

Form submission handler for the theme settings form.

File

core/modules/system/tests/themes/test_theme_settings/src/Hook/TestThemeSettingsHooks.php, line 56

Class

TestThemeSettingsHooks
Hook implementations for test_theme_settings.

Namespace

Drupal\test_theme_settings\Hook

Code

public static function submitForm(array &$form, FormStateInterface $form_state) : void {
  if ($file_id = $form_state->getValue([
    'custom_logo',
    '0',
  ])) {
    $file = File::load($file_id);
    $file->setPermanent();
    $file->save();
  }
}

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