You are here

public function CategorizingPluginManagerTrait::getGroupedDefinitions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getGroupedDefinitions()
1 call to CategorizingPluginManagerTrait::getGroupedDefinitions()
BlockManager::getGroupedDefinitions in core/lib/Drupal/Core/Block/BlockManager.php
Gets sorted plugin definitions grouped by category.

File

core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php, line 110
Contains \Drupal\Core\Plugin\CategorizingPluginManagerTrait.

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 = array();
  foreach ($definitions as $id => $definition) {
    $grouped_definitions[(string) $definition['category']][$id] = $definition;
  }
  return $grouped_definitions;
}