function ModuleRequiredByThemesUninstallValidator::getThemesDependingOnModule

Same name in other branches
  1. 9 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.

1 call to ModuleRequiredByThemesUninstallValidator::getThemesDependingOnModule()
ModuleRequiredByThemesUninstallValidator::validate in core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php
Determines the reasons a module can not be uninstalled.

File

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

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.