You are here

public function TamperManager::getGroupedDefinitions in Tamper 8

Gets sorted plugin definitions grouped by category.

In addition to grouping, both categories and its entries are sorted, whereas plugin definitions are sorted by label.

Parameters

array[]|null $definitions: (optional) The plugin definitions to group. If omitted, all plugin definitions are used.

Return value

array[] Keys are category names, and values are arrays of which the keys are plugin IDs and the values are plugin definitions.

Overrides CategorizingPluginManagerInterface::getGroupedDefinitions

File

src/TamperManager.php, line 68

Class

TamperManager
Provides a Tamper plugin manager.

Namespace

Drupal\tamper

Code

public function getGroupedDefinitions(array $definitions = NULL) {
  $definitions = $this
    ->getSortedDefinitions(isset($definitions) ? $definitions : $this
    ->getDefinitions());
  $grouped_definitions = [];
  foreach ($definitions as $id => $definition) {
    $grouped_definitions[(string) $definition['category']][$id] = $definition;
  }
  return $grouped_definitions;
}