You are here

public function AllowedHtmlManager::getThemeDefinitions in Markdown 8.2

Retrieves definitions supported by the active theme.

Parameters

array $definitions: Optional. Specific definitions to filter, if not provided then all plugins with a "theme" type will be filtered.

\Drupal\Core\Theme\ActiveTheme $activeTheme: Optional. The active them. This is used as an indicator when in "render mode".

Return value

array A filtered list of definitions supported by the active theme.

1 call to AllowedHtmlManager::getThemeDefinitions()
AllowedHtmlManager::appliesTo in src/PluginManager/AllowedHtmlManager.php
Retrieves plugins that apply to a parser and active theme.

File

src/PluginManager/AllowedHtmlManager.php, line 343

Class

AllowedHtmlManager
Markdown Allowed HTML Plugin Manager.

Namespace

Drupal\markdown\PluginManager

Code

public function getThemeDefinitions(array $definitions = NULL, ActiveTheme $activeTheme = NULL) {
  $definitions = isset($definitions) ? $definitions : $this
    ->getType('theme');

  // Only use definitions found in the active theme or its base theme(s).
  if ($activeTheme) {
    $themeAncestry = array_merge(array_keys($activeTheme
      ->getBaseThemes()), [
      $activeTheme
        ->getName(),
    ]);
    foreach ($definitions as $plugin_id => $definition) {
      if (($provider = $definition
        ->getProvider()) && $this->themeHandler
        ->themeExists($provider) && !in_array($provider, $themeAncestry, TRUE)) {
        unset($definitions[$plugin_id]);
      }
    }
  }
  return $definitions;
}