You are here

public function BlockManager::getSortedDefinitions in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Block/BlockManager.php \Drupal\Core\Block\BlockManager::getSortedDefinitions()

Gets sorted plugin definitions.

Parameters

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

Return value

array[] An array of plugin definitions, sorted by category and label.

Overrides CategorizingPluginManagerInterface::getSortedDefinitions

File

core/lib/Drupal/Core/Block/BlockManager.php, line 73

Class

BlockManager
Manages discovery and instantiation of block plugins.

Namespace

Drupal\Core\Block

Code

public function getSortedDefinitions(array $definitions = NULL) {

  // Sort the plugins first by category, then by admin label.
  $definitions = $this
    ->traitGetSortedDefinitions($definitions, 'admin_label');

  // Do not display the 'broken' plugin in the UI.
  unset($definitions['broken']);
  return $definitions;
}