You are here

public static function WebformContentCreatorUtilities::getFormattedWebforms in Webform Content Creator 3.x

Same name and namespace in other branches
  1. 8 src/WebformContentCreatorUtilities.php \Drupal\webform_content_creator\WebformContentCreatorUtilities::getFormattedWebforms()
  2. 2.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 291

Class

WebformContentCreatorUtilities
Provides useful functions required in Webform content creator module.

Namespace

Drupal\webform_content_creator

Code

public static function getFormattedWebforms() {
  $webforms = self::getAllWebforms();
  $result = [];
  foreach ($webforms as $k => $v) {
    $category = $v
      ->get('category');
    if (empty($category)) {
      $result[$k] = $v
        ->label();
    }
    else {
      $result[$category][$k] = $v
        ->label();
    }
  }
  return $result;
}