function TestThemeThemeHooks::themeSettingsSubmit
Test theme form settings submission handler.
File
-
core/
modules/ system/ tests/ themes/ test_theme_theme/ src/ Hook/ TestThemeThemeHooks.php, line 49
Class
- TestThemeThemeHooks
- Hook implementations for test_theme_theme.
Namespace
Drupal\test_theme_theme\HookCode
public function themeSettingsSubmit(&$form, FormStateInterface $form_state) : void {
if ($file_id = $form_state->getValue([
'custom_logo',
'0',
])) {
/** @var Drupal\file\Entity\FileInterface $file */
$file = $this->entityTypeManager
->getStorage('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.