You are here

public function TamperManager::getCategories in Tamper 8

Gets the names of all categories.

Return value

string[] An array of translated categories, sorted alphabetically.

Overrides CategorizingPluginManagerInterface::getCategories

File

src/TamperManager.php, line 56

Class

TamperManager
Provides a Tamper plugin manager.

Namespace

Drupal\tamper

Code

public function getCategories() {

  // Fetch all categories from definitions and remove duplicates.
  $categories = array_unique(array_values(array_map(function ($definition) {
    return $definition['category'];
  }, $this
    ->getDefinitions())));
  natcasesort($categories);
  return $categories;
}