public function WebformImageSelectImagesStorage::getImages 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::getImages()
Get all webform image select images grouped by category.
Return value
string[] An array of webform image select images grouped by category.
Overrides WebformImageSelectImagesStorageInterface::getImages
File
- modules/
webform_image_select/ src/ WebformImageSelectImagesStorage.php, line 38
Class
- WebformImageSelectImagesStorage
- Storage controller class for "webform_image_select_images" configuration entities.
Namespace
Drupal\webform_image_selectCode
public function getImages() {
$webform_images = $this
->loadMultiple();
@uasort($webform_images, [
$this->entityType
->getClass(),
'sort',
]);
$uncategorized_images = [];
$categorized_images = [];
foreach ($webform_images as $id => $webform_image) {
if ($category = $webform_image
->get('category')) {
$categorized_images[$category][$id] = $webform_image
->label();
}
else {
$uncategorized_images[$id] = $webform_image
->label();
}
}
return $uncategorized_images + $categorized_images;
}