function DefaultPluginManager::processDefinition

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::processDefinition()
  2. 10 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.

15 calls to DefaultPluginManager::processDefinition()
BlockManager::processDefinition in core/lib/Drupal/Core/Block/BlockManager.php
Performs extra processing on plugin definitions.
BreakpointManager::processDefinition in core/modules/breakpoint/src/BreakpointManager.php
Performs extra processing on plugin definitions.
CategorizingPluginManager::processDefinition in core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php
Performs extra processing on plugin definitions.
ConfigMapperManager::processDefinition in core/modules/config_translation/src/ConfigMapperManager.php
Performs extra processing on plugin definitions.
ContextualLinkManager::processDefinition in core/lib/Drupal/Core/Menu/ContextualLinkManager.php
Performs extra processing on plugin definitions.

... See full list

13 methods override DefaultPluginManager::processDefinition()
BlockManager::processDefinition in core/lib/Drupal/Core/Block/BlockManager.php
Performs extra processing on plugin definitions.
BreakpointManager::processDefinition in core/modules/breakpoint/src/BreakpointManager.php
Performs extra processing on plugin definitions.
CategorizingPluginManager::processDefinition in core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php
Performs extra processing on plugin definitions.
ConfigMapperManager::processDefinition in core/modules/config_translation/src/ConfigMapperManager.php
Performs extra processing on plugin definitions.
ConstraintManager::processDefinition in core/lib/Drupal/Core/Validation/ConstraintManager.php
Performs extra processing on plugin definitions.

... See full list

File

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

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) {
        $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.