public function ParserManager::processDefinition in Markdown 8.2
Performs extra processing on plugin definitions.
By default we add defaults for the type to the definition. If a type has additional processing logic they can do that by replacing or extending the method.
Overrides InstallablePluginManager::processDefinition
File
- src/
PluginManager/ ParserManager.php, line 105
Class
- ParserManager
- Markdown Parser Plugin Manager.
Namespace
Drupal\markdown\PluginManagerCode
public function processDefinition(&$definition, $plugin_id) {
parent::processDefinition($definition, $plugin_id);
if (!$definition instanceof MarkdownParser || !$definition
->isInstalled() || !($class = $definition
->getClass())) {
return;
}
// Process extensible parser support.
if (is_subclass_of($class, ExtensibleParserInterface::class)) {
if (!$definition->extensionInterfaces) {
throw new InvalidPluginDefinitionException($plugin_id, sprintf('Markdown parser "%s" implements %s but is missing "extensionInterfaces" in the definition.', $plugin_id, ExtensibleParserInterface::class));
}
foreach (array_map('\\Drupal\\markdown\\PluginManager\\InstallablePluginManager::normalizeClassName', $definition->extensionInterfaces) as $interface) {
if ($interface === ExtensionInterface::class) {
throw new InvalidPluginDefinitionException($plugin_id, sprintf('Markdown parser "%s" cannot specify %s as the extension interface. It must create its own unique interface that extend from it.', $plugin_id, ExtensionInterface::class));
}
if (!interface_exists($interface)) {
throw new InvalidPluginDefinitionException($plugin_id, sprintf('Markdown parser "%s" indicates that it supports the extension interface "%s", but this interface does not exist.', $plugin_id, $interface));
}
if (!is_subclass_of($interface, ExtensionInterface::class)) {
throw new InvalidPluginDefinitionException($plugin_id, sprintf('Markdown parser "%s" indicates that it supports the extension interface "%s", but this interface does not extend %s.', $plugin_id, $interface, ExtensionInterface::class));
}
}
}
}