function CategorizingPluginManagerTrait::processDefinitionCategory

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::processDefinitionCategory()
  2. 8.9.x core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::processDefinitionCategory()
  3. 10 core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::processDefinitionCategory()

Processes a plugin definition to ensure there is a category.

If the definition lacks a category, it defaults to the providing module.

Parameters

array $definition: The plugin definition.

2 calls to CategorizingPluginManagerTrait::processDefinitionCategory()
BlockManager::processDefinition in core/lib/Drupal/Core/Block/BlockManager.php
Performs extra processing on plugin definitions.
CategorizingPluginManager::processDefinition in core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php
Performs extra processing on plugin definitions.

File

core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php, line 31

Class

CategorizingPluginManagerTrait
Provides a trait for the CategorizingPluginManagerInterface.

Namespace

Drupal\Core\Plugin

Code

protected function processDefinitionCategory(&$definition) {
    // Ensure that every plugin has a category.
    if (empty($definition['category'])) {
        // Default to the human readable module name if the provider is a module;
        // otherwise the provider machine name is used.
        $definition['category'] = $this->getProviderName($definition['provider']);
    }
}

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