public function WebformOptionsStorage::getCategories in Webform 8.5
Same name and namespace in other branches
- 6.x src/WebformOptionsStorage.php \Drupal\webform\WebformOptionsStorage::getCategories()
Gets the names of all categories.
Return value
string[] An array of translated categories, sorted alphabetically.
Overrides WebformOptionsStorageInterface::getCategories
File
- src/
WebformOptionsStorage.php, line 95
Class
- WebformOptionsStorage
- Storage controller class for "webform_options" configuration entities.
Namespace
Drupal\webformCode
public function getCategories() {
$webform_options = $this
->loadMultiple();
$categories = [];
foreach ($webform_options as $webform_option) {
if ($category = $webform_option
->get('category')) {
$categories[$category] = $category;
}
}
ksort($categories);
return $categories;
}