diff --git a/core/modules/system/src/Form/ThemeSettingsForm.php b/core/modules/system/src/Form/ThemeSettingsForm.php index f5cfb09..466e959 100644 --- a/core/modules/system/src/Form/ThemeSettingsForm.php +++ b/core/modules/system/src/Form/ThemeSettingsForm.php @@ -324,9 +324,21 @@ public function buildForm(array $form, FormStateInterface $form_state, $theme = // Process the theme and all its base themes. foreach ($theme_keys as $theme) { // Include the theme-settings.php file. - $filename = DRUPAL_ROOT . '/' . $themes[$theme]->getPath() . '/theme-settings.php'; - if (file_exists($filename)) { - require_once $filename; + $theme_path = drupal_get_path('theme', $theme); + $theme_settings_file = $theme_path . '/theme-settings.php'; + $theme_file = $theme_path . '/' . $theme . '.theme'; + $filenames = [$theme_settings_file, $theme_file]; + foreach ($filenames as $filename) { + if (file_exists($filename)) { + require_once $filename; + + // The file must be require for cached form too. + $files = $form_state->getBuildInfo()['files']; + if (!in_array($filename, $files)) { + $files[] = $filename; + } + $form_state->addBuildInfo('files', $files); + } } // Call theme-specific settings.