You are here

public function TamperManager::getSortedDefinitions in Tamper 8

Return value

\Drupal\tamper\TamperInterface[] List of tamper plugins.

Overrides CategorizingPluginManagerInterface::getSortedDefinitions

1 call to TamperManager::getSortedDefinitions()
TamperManager::getGroupedDefinitions in src/TamperManager.php
Gets sorted plugin definitions grouped by category.

File

src/TamperManager.php, line 83

Class

TamperManager
Provides a Tamper plugin manager.

Namespace

Drupal\tamper

Code

public function getSortedDefinitions(array $definitions = NULL) {

  // Sort the plugins first by category, then by label.
  $definitions = isset($definitions) ? $definitions : $this
    ->getDefinitions();
  uasort($definitions, function ($a, $b) {
    if ($a['category'] != $b['category']) {
      return strnatcasecmp($a['category'], $b['category']);
    }
    return strnatcasecmp($a['label'], $b['label']);
  });
  return $definitions;
}