function ModuleRequiredByThemesUninstallValidator::getThemesDependingOnModule

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php \Drupal\Core\Extension\ModuleRequiredByThemesUninstallValidator::getThemesDependingOnModule()
  2. 10 core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php \Drupal\Core\Extension\ModuleRequiredByThemesUninstallValidator::getThemesDependingOnModule()
  3. 11.x core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php \Drupal\Core\Extension\ModuleRequiredByThemesUninstallValidator::getThemesDependingOnModule()

Returns themes that depend on a module.

Parameters

string $module: The module machine name.

Return value

string[] An array of the names of themes that depend on $module keyed by the theme's machine name.

2 calls to ModuleRequiredByThemesUninstallValidator::getThemesDependingOnModule()
ModuleRequiredByThemesUninstallValidator::validate in core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php
Determines the reasons a module can not be uninstalled.
ModuleRequiredByThemesUninstallValidator::validateConfigImport in core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php
Determines reasons a module can not be uninstalled prior to config import.

File

core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php, line 96

Class

ModuleRequiredByThemesUninstallValidator
Ensures modules cannot be uninstalled if enabled themes depend on them.

Namespace

Drupal\Core\Extension

Code

protected function getThemesDependingOnModule($module) {
    $installed_themes = $this->themeExtensionList
        ->getAllInstalledInfo();
    $themes_depending_on_module = array_map(function ($theme) use ($module) {
        if (in_array($module, $theme['dependencies'])) {
            return $theme['name'];
        }
    }, $installed_themes);
    return array_filter($themes_depending_on_module);
}

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