You are here

public function WebformAnalysisBlock::getEntities in Webform Analysis 8

Get Webforms.

Return value

array Names.

1 call to WebformAnalysisBlock::getEntities()
WebformAnalysisBlock::blockForm in src/Plugin/Block/WebformAnalysisBlock.php

File

src/Plugin/Block/WebformAnalysisBlock.php, line 178

Class

WebformAnalysisBlock
Provides a 'Webform' block.

Namespace

Drupal\webform_analysis\Plugin\Block

Code

public function getEntities() {
  $entity_storage = $this->entityTypeManager
    ->getStorage(static::elementEntityTypeId());
  foreach ($entity_storage
    ->loadMultiple() as $entity) {
    $entity_id = $entity
      ->id();
    $label = $entity
      ->label();
    if ($label) {
      $names[$entity_id] = new TranslatableMarkup('@label (@id)', [
        '@label' => $label,
        '@id' => $entity_id,
      ]);
    }
    else {
      $names[$entity_id] = $entity_id;
    }
  }
  return $names;
}