You are here

protected function ServiceEndpointResources::getCategoryDefinitions in Services 8.4

Same name and namespace in other branches
  1. 9.0.x src/Controller/ServiceEndpointResources.php \Drupal\services\Controller\ServiceEndpointResources::getCategoryDefinitions()

Get service definitions grouped by category.

Return value

array An array of resource definitions keyed by category.

1 call to ServiceEndpointResources::getCategoryDefinitions()
ServiceEndpointResources::displayList in src/Controller/ServiceEndpointResources.php
List service resources.

File

src/Controller/ServiceEndpointResources.php, line 162

Class

ServiceEndpointResources
Class \Drupal\services\Controller\ServiceEndpointManageResource.

Namespace

Drupal\services\Controller

Code

protected function getCategoryDefinitions() {
  $definitions = [];
  foreach ($this->pluginManager
    ->getDefinitions() as $plugin_id => $definition) {
    if (!isset($definition['category'])) {
      continue;
    }
    $category = $definition['category']
      ->render();
    $definitions[$category][$plugin_id] = $definition;
  }
  ksort($definitions);
  return $definitions;
}