function CategorizingPluginManagerTrait::getGroupedDefinitions

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getGroupedDefinitions()
  2. 8.9.x core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getGroupedDefinitions()
  3. 10 core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getGroupedDefinitions()
1 call to CategorizingPluginManagerTrait::getGroupedDefinitions()
FieldTypePluginManager::getGroupedDefinitions in core/lib/Drupal/Core/Field/FieldTypePluginManager.php
Gets sorted field type definitions grouped by category.

File

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

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($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.