You are here

public function AllowedHtmlManager::getParserDefinitions in Markdown 8.2

Retrieves the definition provided by the parser.

Parameters

\Drupal\markdown\Plugin\Markdown\ParserInterface $parser: A parser.

array $definitions: Optional. Specific definitions to filter, if not provided then all plugins with an "extension" 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 provided by the parser.

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

File

src/PluginManager/AllowedHtmlManager.php, line 303

Class

AllowedHtmlManager
Markdown Allowed HTML Plugin Manager.

Namespace

Drupal\markdown\PluginManager

Code

public function getParserDefinitions(ParserInterface $parser, array $definitions = NULL, ActiveTheme $activeTheme = NULL) {
  $definitions = isset($definitions) ? $definitions : $this
    ->getType('parser');
  $parserClass = static::normalizeClassName(get_class($parser));
  foreach ($definitions as $plugin_id => $definition) {
    $class = static::normalizeClassName($definition
      ->getClass());
    if ($parserClass !== $class && !is_subclass_of($parser, $class)) {
      unset($definitions[$plugin_id]);
    }
  }
  return $definitions;
}