function CategorizingPluginManagerTrait::getGroupedDefinitions

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

File

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

Class

CategorizingPluginManagerTrait
Provides a trait for the CategorizingPluginManagerInterface.

Namespace

Drupal\Core\Plugin

Code

public function getGroupedDefinitions(array $definitions = NULL, $label_key = 'label') {
    
    /** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */
    $definitions = $this->getSortedDefinitions(isset($definitions) ? $definitions : $this->getDefinitions(), $label_key);
    $grouped_definitions = [];
    foreach ($definitions as $id => $definition) {
        $grouped_definitions[(string) $definition['category']][$id] = $definition;
    }
    return $grouped_definitions;
}

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