You are here

protected function LogTemplateManager::getSortedDefinitions in Commerce Core 8.2

Gets the sorted commerce_log_template plugin definitions.

Return value

array The commerce_log_template plugin definitions, sorted by category and label.

1 call to LogTemplateManager::getSortedDefinitions()
LogTemplateManager::getLabelsByCategory in modules/log/src/LogTemplateManager.php
Gets the log template labels grouped by category.

File

modules/log/src/LogTemplateManager.php, line 114

Class

LogTemplateManager
Manages discovery and instantiation of commerce_log_template plugins.

Namespace

Drupal\commerce_log

Code

protected function getSortedDefinitions() {

  // Sort the plugins first by category, then by label.
  $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;
}