function DefaultSelection::validateReferenceableNewEntities

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::validateReferenceableNewEntities()
  2. 8.9.x core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::validateReferenceableNewEntities()
  3. 11.x core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::validateReferenceableNewEntities()

Overrides SelectionWithAutocreateInterface::validateReferenceableNewEntities

6 calls to DefaultSelection::validateReferenceableNewEntities()
CommentSelection::validateReferenceableNewEntities in core/modules/comment/src/Plugin/EntityReferenceSelection/CommentSelection.php
Validates which newly created entities can be referenced.
FileSelection::validateReferenceableNewEntities in core/modules/file/src/Plugin/EntityReferenceSelection/FileSelection.php
Validates which newly created entities can be referenced.
MediaSelection::validateReferenceableNewEntities in core/modules/media/src/Plugin/EntityReferenceSelection/MediaSelection.php
Validates which newly created entities can be referenced.
NodeSelection::validateReferenceableNewEntities in core/modules/node/src/Plugin/EntityReferenceSelection/NodeSelection.php
Validates which newly created entities can be referenced.
TermSelection::validateReferenceableNewEntities in core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php
Validates which newly created entities can be referenced.

... See full list

6 methods override DefaultSelection::validateReferenceableNewEntities()
CommentSelection::validateReferenceableNewEntities in core/modules/comment/src/Plugin/EntityReferenceSelection/CommentSelection.php
Validates which newly created entities can be referenced.
FileSelection::validateReferenceableNewEntities in core/modules/file/src/Plugin/EntityReferenceSelection/FileSelection.php
Validates which newly created entities can be referenced.
MediaSelection::validateReferenceableNewEntities in core/modules/media/src/Plugin/EntityReferenceSelection/MediaSelection.php
Validates which newly created entities can be referenced.
NodeSelection::validateReferenceableNewEntities in core/modules/node/src/Plugin/EntityReferenceSelection/NodeSelection.php
Validates which newly created entities can be referenced.
TermSelection::validateReferenceableNewEntities in core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php
Validates which newly created entities can be referenced.

... See full list

File

core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php, line 423

Class

DefaultSelection
Default plugin implementation of the Entity Reference Selection plugin.

Namespace

Drupal\Core\Entity\Plugin\EntityReferenceSelection

Code

public function validateReferenceableNewEntities(array $entities) {
    return array_filter($entities, function ($entity) {
        $target_bundles = $this->getConfiguration()['target_bundles'];
        if (isset($target_bundles)) {
            return in_array($entity->bundle(), $target_bundles);
        }
        return TRUE;
    });
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.