You are here

protected function ThemeController::willInstallExperimentalTheme in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/src/Controller/ThemeController.php \Drupal\system\Controller\ThemeController::willInstallExperimentalTheme()
  2. 9 core/modules/system/src/Controller/ThemeController.php \Drupal\system\Controller\ThemeController::willInstallExperimentalTheme()

Checks if the given theme requires the installation of experimental themes.

Parameters

string $theme: The name of the theme to check.

Return value

bool Whether experimental themes will be installed.

2 calls to ThemeController::willInstallExperimentalTheme()
ThemeController::install in core/modules/system/src/Controller/ThemeController.php
Installs a theme.
ThemeController::setDefaultTheme in core/modules/system/src/Controller/ThemeController.php
Set the default theme.

File

core/modules/system/src/Controller/ThemeController.php, line 184

Class

ThemeController
Controller for theme handling.

Namespace

Drupal\system\Controller

Code

protected function willInstallExperimentalTheme($theme) {
  $all_themes = $this->themeList
    ->getList();
  $dependencies = array_keys($all_themes[$theme]->requires);
  $themes_to_enable = array_merge([
    $theme,
  ], $dependencies);
  foreach ($themes_to_enable as $name) {
    if (isset($all_themes[$name]) && $all_themes[$name]
      ->isExperimental() && $all_themes[$name]->status === 0) {
      return TRUE;
    }
  }
  return FALSE;
}