public function BaseExtensibleParser::getConfiguration in Markdown 8.2
Gets this plugin's configuration.
Return value
array An array of this plugin's configuration.
Overrides BaseParser::getConfiguration
1 call to BaseExtensibleParser::getConfiguration()
- CommonMark::getConfiguration in src/
Plugin/ Markdown/ CommonMark/ CommonMark.php - Gets this plugin's configuration.
1 method overrides BaseExtensibleParser::getConfiguration()
- CommonMark::getConfiguration in src/
Plugin/ Markdown/ CommonMark/ CommonMark.php - Gets this plugin's configuration.
File
- src/
Plugin/ Markdown/ BaseExtensibleParser.php, line 75
Class
- BaseExtensibleParser
- Base class for extensible markdown parsers.
Namespace
Drupal\markdown\Plugin\MarkdownCode
public function getConfiguration() {
$configuration = parent::getConfiguration();
// Normalize extensions and their settings.
$extensions = [];
$extensionCollection = $this
->extensions();
/** @var \Drupal\markdown\Plugin\Markdown\ExtensionInterface $extension */
foreach ($extensionCollection as $extensionId => $extension) {
// Only include extensions that have configuration overrides.
if ($overrides = $extension
->getConfigurationOverrides()) {
$extensionConfiguration = $extension
->getSortedConfiguration();
// This is part of the parser config, the extension dependencies
// aren't needed as they're determined and merged elsewhere.
unset($extensionConfiguration['dependencies']);
$extensions[] = $extensionConfiguration;
}
}
// Sort extensions so they're always in the same order.
uasort($extensions, function ($a, $b) {
return SortArray::sortByKeyString($a, $b, 'id');
});
// Don't use an associative array, just an indexed list of extensions.
$configuration['extensions'] = array_values($extensions);
return $configuration;
}