You are here

protected function CategorizingPluginManagerTrait::processDefinitionCategory in Drupal 8

Same name and namespace in other branches
  1. 9 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 29

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']);
  }
}