You are here

public function WebformEntityListBuilder::load in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformEntityListBuilder.php \Drupal\webform\WebformEntityListBuilder::load()

Loads entities of this type from storage for listing.

This allows the implementation to manipulate the listing, like filtering or sorting the loaded entities.

Return value

\Drupal\Core\Entity\EntityInterface[] An array of entities implementing \Drupal\Core\Entity\EntityInterface indexed by their IDs. Returns an empty array if no matching entities are found.

Overrides ConfigEntityListBuilder::load

File

src/WebformEntityListBuilder.php, line 559

Class

WebformEntityListBuilder
Defines a class to build a listing of webform entities.

Namespace

Drupal\webform

Code

public function load() {
  $entity_ids = $this
    ->getEntityIds();

  /* @var $entities \Drupal\webform\WebformInterface[] */
  $entities = $this->storage
    ->loadMultiple($entity_ids);

  // If the user is not a webform admin, check access to each webform.
  if (!$this
    ->isAdmin()) {
    foreach ($entities as $entity_id => $entity) {
      if (!$entity
        ->access('update', $this->currentUser) && !$entity
        ->access('submission_view_any', $this->currentUser)) {
        unset($entities[$entity_id]);
      }
    }
  }
  return $entities;
}