public function LayoutPluginManager::getCategories in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Layout/LayoutPluginManager.php \Drupal\Core\Layout\LayoutPluginManager::getCategories()
- 10 core/lib/Drupal/Core/Layout/LayoutPluginManager.php \Drupal\Core\Layout\LayoutPluginManager::getCategories()
Gets the names of all categories.
Return value
string[] An array of translated categories, sorted alphabetically.
Overrides CategorizingPluginManagerInterface::getCategories
File
- core/
lib/ Drupal/ Core/ Layout/ LayoutPluginManager.php, line 185
Class
- LayoutPluginManager
- Provides a plugin manager for layouts.
Namespace
Drupal\Core\LayoutCode
public function getCategories() {
// Fetch all categories from definitions and remove duplicates.
$categories = array_unique(array_values(array_map(function (LayoutDefinition $definition) {
return $definition
->getCategory();
}, $this
->getDefinitions())));
natcasesort($categories);
return $categories;
}