function ThemeController::willInstallExperimentalTheme

Same name in other branches
  1. 9 core/modules/system/src/Controller/ThemeController.php \Drupal\system\Controller\ThemeController::willInstallExperimentalTheme()
  2. 8.9.x core/modules/system/src/Controller/ThemeController.php \Drupal\system\Controller\ThemeController::willInstallExperimentalTheme()
  3. 10 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 171

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;
}

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