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