You are here

function icon_enabled_themes in Icon API 8

Same name and namespace in other branches
  1. 7 includes/utilities.inc \icon_enabled_themes()

Determine which themes are enabled.

Return value

array An array of theme names.

1 call to icon_enabled_themes()
icon_extension_implements in includes/utilities.inc
Determines which extensions are implementing a hook.

File

includes/utilities.inc, line 269
utilities.inc Provides useful functions and common tasks.

Code

function icon_enabled_themes() {
  $themes =& drupal_static(__FUNCTION__);
  if (!isset($themes)) {
    $themes = array();
    foreach (\Drupal::service('theme_handler')
      ->listInfo() as $theme) {
      if (!$theme->status || in_array($theme
        ->getName(), $themes)) {
        continue;
      }
      $themes[] = $theme
        ->getName();

      // Merge in the base themes if this is a sub-theme.
      if (isset($theme->sub_themes)) {

        // Only add the theme if it's not already in the list.
        foreach (array_keys($theme->sub_themes) as $name) {
          if (!in_array($name, $themes)) {
            $themes[] = $name;
          }
        }
      }
    }
  }
  return $themes;
}