public function AllowedHtmlManager::getFilterDefinitions in Markdown 8.2
Retrieves definitions required by filters.
Parameters
\Drupal\filter\Entity\FilterFormat $filterFormat: A filter format.
array $definitions: Optional. Specific definitions to filter, if not provided then all plugins with a "filter" 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 required filter.
1 call to AllowedHtmlManager::getFilterDefinitions()
- AllowedHtmlManager::appliesTo in src/
PluginManager/ AllowedHtmlManager.php - Retrieves plugins that apply to a parser and active theme.
File
- src/
PluginManager/ AllowedHtmlManager.php, line 255
Class
- AllowedHtmlManager
- Markdown Allowed HTML Plugin Manager.
Namespace
Drupal\markdown\PluginManagerCode
public function getFilterDefinitions(FilterFormat $filterFormat = NULL, array $definitions = NULL, ActiveTheme $activeTheme = NULL) {
// Immediately return if no filter format was provided.
if (!$filterFormat) {
return [];
}
/** @var \Drupal\markdown\Annotation\MarkdownAllowedHtml[] $definitions */
$definitions = isset($definitions) ? $definitions : $this
->getType('filter', $definitions);
$filters = $filterFormat
->filters();
foreach ($definitions as $plugin_id => $definition) {
// Remove definitions if:
// 1. Doesn't have "requiresFilter" set.
// 2. Filter specified by "requiresFilter" doesn't exist.
// 3. Filter specified by "requiresFilter" isn't actually being used
// (status/enabled) during time of render (ActiveTheme).
if (!$definition
->getRequirementsByType('filter', $plugin_id) || !$filters
->has($plugin_id) || $activeTheme && !$filters
->get($plugin_id)->status) {
unset($definitions[$plugin_id]);
}
}
return $definitions;
}