You are here

protected function WorkflowManager::getSortedDefinitions in State Machine 8

Gets the sorted workflow plugin definitions.

Return value

array The workflow plugin definitions, sorted by group and label.

1 call to WorkflowManager::getSortedDefinitions()
WorkflowManager::getGroupedLabels in src/WorkflowManager.php
Gets the grouped workflow labels.

File

src/WorkflowManager.php, line 167

Class

WorkflowManager
Manages discovery and instantiation of workflow plugins.

Namespace

Drupal\state_machine

Code

protected function getSortedDefinitions() {

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