interface SelectionInterface

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionInterface.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionInterface.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface
  3. 10 core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionInterface.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface

Interface definition for Entity Reference Selection plugins.

Hierarchy

Expanded class hierarchy of SelectionInterface

All classes that implement SelectionInterface

See also

\Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager

\Drupal\Core\Entity\Annotation\EntityReferenceSelection

Plugin API

1 file declares its use of SelectionInterface
EntityAutocomplete.php in core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
1 string reference to 'SelectionInterface'
core.data_types.schema.yml in core/config/schema/core.data_types.schema.yml
core/config/schema/core.data_types.schema.yml

File

core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionInterface.php, line 19

Namespace

Drupal\Core\Entity\EntityReferenceSelection
View source
interface SelectionInterface extends PluginFormInterface {
    
    /**
     * Gets the list of referenceable entities.
     *
     * @param string|null $match
     *   (optional) Text to match the label against. Defaults to NULL.
     * @param string $match_operator
     *   (optional) Operator to be used for string matching. Defaults to
     *   "CONTAINS".
     * @param int $limit
     *   (optional) Limit the query to a given number of items. Defaults to 0,
     *   which indicates no limiting.
     *
     * @return array
     *   A nested array of entities, the first level is keyed by the
     *   entity bundle, which contains an array of entity labels (escaped),
     *   keyed by the entity ID.
     */
    public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0);
    
    /**
     * Counts entities that are referenceable.
     *
     * @param string $match
     *   (optional) Text to match the label against. Defaults to NULL.
     * @param string $match_operator
     *   (optional) Operator to be used for string matching. Defaults to
     *   "CONTAINS".
     *
     * @return int
     *   The number of referenceable entities.
     */
    public function countReferenceableEntities($match = NULL, $match_operator = 'CONTAINS');
    
    /**
     * Validates which existing entities can be referenced.
     *
     * @param array $ids
     *   An array of IDs to validate.
     *
     * @return array
     *   An array of valid entity IDs.
     */
    public function validateReferenceableEntities(array $ids);
    
    /**
     * Allows the selection to alter the SelectQuery generated by EntityFieldQuery.
     *
     * @param \Drupal\Core\Database\Query\SelectInterface $query
     *   A Select Query object.
     */
    public function entityQueryAlter(SelectInterface $query);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
PluginFormInterface::buildConfigurationForm public function Form constructor. 31
PluginFormInterface::submitConfigurationForm public function Form submission handler. 29
PluginFormInterface::validateConfigurationForm public function Form validation handler. 16
SelectionInterface::countReferenceableEntities public function Counts entities that are referenceable. 3
SelectionInterface::entityQueryAlter public function Allows the selection to alter the SelectQuery generated by EntityFieldQuery. 1
SelectionInterface::getReferenceableEntities public function Gets the list of referenceable entities. 3
SelectionInterface::validateReferenceableEntities public function Validates which existing entities can be referenced. 3

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