public static function WebformContentCreatorUtilities::getFormattedWebforms in Webform Content Creator 2.x
Same name and namespace in other branches
- 8 src/WebformContentCreatorUtilities.php \Drupal\webform_content_creator\WebformContentCreatorUtilities::getFormattedWebforms()
- 3.x src/WebformContentCreatorUtilities.php \Drupal\webform_content_creator\WebformContentCreatorUtilities::getFormattedWebforms()
Get an associative array with webform ids and respective labels.
Return value
array Associative array with webform ids and labels.
1 call to WebformContentCreatorUtilities::getFormattedWebforms()
- WebformContentCreatorForm::form in src/
Form/ WebformContentCreatorForm.php - Gets the actual form array to be built.
File
- src/
WebformContentCreatorUtilities.php, line 255
Class
- WebformContentCreatorUtilities
- Provides useful functions required in Webform content creator module.
Namespace
Drupal\webform_content_creatorCode
public static function getFormattedWebforms() {
$webforms = self::getAllWebforms();
$webforms_formatted = [];
foreach ($webforms as $k => $v) {
$category = $v
->get('category');
if (empty($category)) {
$webforms_formatted[$k] = $v
->label();
}
else {
$webforms_formatted[$category][$k] = $v
->label();
}
}
return $webforms_formatted;
}