You are here

protected function ModuleRequiredByThemesUninstallValidator::getThemesDependingOnModule in Drupal 8

Same name and namespace 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()

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