public function WebformOptionsCustomStorage::getOptionsCustom in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_options_custom/src/WebformOptionsCustomStorage.php \Drupal\webform_options_custom\WebformOptionsCustomStorage::getOptionsCustom()
Get all webform options custom grouped by category.
Return value
string[] An array of webform options custom grouped by category.
Overrides WebformOptionsCustomStorageInterface::getOptionsCustom
File
- modules/
webform_options_custom/ src/ WebformOptionsCustomStorage.php, line 38
Class
- WebformOptionsCustomStorage
- Storage controller class for "webform_options_custom" configuration entities.
Namespace
Drupal\webform_options_customCode
public function getOptionsCustom() {
$webform_options_custom = $this
->loadMultiple();
@uasort($webform_options_custom, [
$this->entityType
->getClass(),
'sort',
]);
$uncategorized_options_custom = [];
$categorized_options_custom = [];
foreach ($webform_options_custom as $id => $webform_image) {
if ($category = $webform_image
->get('category')) {
$categorized_options_custom[$category][$id] = $webform_image
->label();
}
else {
$uncategorized_options_custom[$id] = $webform_image
->label();
}
}
return $uncategorized_options_custom + $categorized_options_custom;
}