function DefaultPluginManager::processDefinition

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::processDefinition()
  2. 8.9.x core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::processDefinition()
  3. 11.x core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::processDefinition()

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.

16 calls to DefaultPluginManager::processDefinition()
BlockManager::processDefinition in core/lib/Drupal/Core/Block/BlockManager.php
BreakpointManager::processDefinition in core/modules/breakpoint/src/BreakpointManager.php
CategorizingPluginManager::processDefinition in core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php
CKEditor5PluginManager::processDefinition in core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
ConfigMapperManager::processDefinition in core/modules/config_translation/src/ConfigMapperManager.php

... See full list

14 methods override DefaultPluginManager::processDefinition()
BlockManager::processDefinition in core/lib/Drupal/Core/Block/BlockManager.php
BreakpointManager::processDefinition in core/modules/breakpoint/src/BreakpointManager.php
CategorizingPluginManager::processDefinition in core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php
CKEditor5PluginManager::processDefinition in core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
ConfigMapperManager::processDefinition in core/modules/config_translation/src/ConfigMapperManager.php

... See full list

File

core/lib/Drupal/Core/Plugin/DefaultPluginManager.php, line 285

Class

DefaultPluginManager
Base class for plugin managers.

Namespace

Drupal\Core\Plugin

Code

public function processDefinition(&$definition, $plugin_id) {
    // Only array-based definitions can have defaults merged in.
    if (is_array($definition) && !empty($this->defaults) && is_array($this->defaults)) {
        $definition = NestedArray::mergeDeep($this->defaults, $definition);
    }
    // Keep class definitions standard with no leading slash.
    if ($definition instanceof PluginDefinitionInterface) {
        assert(is_string($definition->getClass()), 'Plugin definitions must have a class');
        $definition->setClass(ltrim($definition->getClass(), '\\'));
    }
    elseif (is_array($definition) && isset($definition['class'])) {
        $definition['class'] = ltrim($definition['class'], '\\');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.