You are here

public function AllowedHtmlManager::getSortedDefinitions in Markdown 8.2

1 call to AllowedHtmlManager::getSortedDefinitions()
AllowedHtmlManager::getGroupedDefinitions in src/PluginManager/AllowedHtmlManager.php

File

src/PluginManager/AllowedHtmlManager.php, line 318

Class

AllowedHtmlManager
Markdown Allowed HTML Plugin Manager.

Namespace

Drupal\markdown\PluginManager

Code

public function getSortedDefinitions(array $definitions = NULL, $label_key = 'label') {

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