You are here

interface SelectionInterface in Entity reference 8

Interface definition for entityre-ference selection plugins.

Hierarchy

Expanded class hierarchy of SelectionInterface

All classes that implement SelectionInterface

1 file declares its use of SelectionInterface
SelectionBase.php in lib/Drupal/entityreference/Plugin/entityreference/selection/SelectionBase.php
Definition of Drupal\entityreference\Plugin\entityreference\selection\SelectionBase.

File

lib/Drupal/entityreference/Plugin/Type/Selection/SelectionInterface.php, line 16
Definition of Drupal\entityreference\Plugin\Type\Selection\SelectionInterface.

Namespace

Drupal\entityreference\Plugin\Type\Selection
View source
interface SelectionInterface {

  /**
   * Return a list of referencable entities.
   *
   * @return
   *   An array of referencable entities, which keys are entity ids and
   *   values (safe HTML) labels to be displayed to the user.
   */
  public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0);

  /**
   * Count entities that are referencable by a given field.
   */
  public function countReferencableEntities($match = NULL, $match_operator = 'CONTAINS');

  /**
   * Validate that entities can be referenced by this field.
   *
   * @return
   *   An array of entity ids that are valid.
   */
  public function validateReferencableEntities(array $ids);

  /**
   * Validate Input from autocomplete widget that has no Id.
   *
   * @see _entityreference_autocomplete_validate()
   *
   * @param $input
   *   Single string from autocomplete widget.
   * @param $element
   *   The form element to set a form error.
   * @return
   *   Value of a matching entity id, or NULL if none.
   */
  public function validateAutocompleteInput($input, &$element, &$form_state, $form);

  /**
   * Give the handler a chance to alter the SelectQuery generated by EntityFieldQuery.
   */
  public function entityFieldQueryAlter(AlterableInterface $query);

  /**
   * Generate a settings form for this handler.
   */
  public static function settingsForm($field, $instance);

}

Members

Namesort descending Modifiers Type Description Overrides
SelectionInterface::countReferencableEntities public function Count entities that are referencable by a given field. 2
SelectionInterface::entityFieldQueryAlter public function Give the handler a chance to alter the SelectQuery generated by EntityFieldQuery. 2
SelectionInterface::getReferencableEntities public function Return a list of referencable entities. 2
SelectionInterface::settingsForm public static function Generate a settings form for this handler. 2
SelectionInterface::validateAutocompleteInput public function Validate Input from autocomplete widget that has no Id. 2
SelectionInterface::validateReferencableEntities public function Validate that entities can be referenced by this field. 2