function EntityReference::getDefaultSelectedEntities
Gets all entities selected by default.
Return value
\Drupal\Core\Entity\EntityInterface[] All entities selected by default, or an empty array, if none.
2 calls to EntityReference::getDefaultSelectedEntities()
- EntityReference::calculateDependencies in core/
modules/ views/ src/ Plugin/ views/ filter/ EntityReference.php - Calculates dependencies for the configured plugin.
- EntityReference::valueFormAddAutocomplete in core/
modules/ views/ src/ Plugin/ views/ filter/ EntityReference.php - Adds an autocomplete element to the form.
File
-
core/
modules/ views/ src/ Plugin/ views/ filter/ EntityReference.php, line 547
Class
- EntityReference
- Filters a view by entity references.
Namespace
Drupal\views\Plugin\views\filterCode
protected function getDefaultSelectedEntities() : array {
$referenced_type_id = $this->getReferencedEntityType()
->id();
$entity_storage = $this->entityTypeManager
->getStorage($referenced_type_id);
return !empty($this->value) && !isset($this->value[static::ALL_VALUE]) ? $entity_storage->loadMultiple($this->value) : [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.