interface SelectionWithAutocreateInterface in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionWithAutocreateInterface.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionWithAutocreateInterface
- 9 core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionWithAutocreateInterface.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionWithAutocreateInterface
Interface for Selection plugins that support newly created entities.
Hierarchy
- interface \Drupal\Core\Entity\EntityReferenceSelection\SelectionWithAutocreateInterface
Expanded class hierarchy of SelectionWithAutocreateInterface
All classes that implement SelectionWithAutocreateInterface
See also
\Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager
\Drupal\Core\Entity\Annotation\EntityReferenceSelection
3 files declare their use of SelectionWithAutocreateInterface
- DefaultSelection.php in core/
lib/ Drupal/ Core/ Entity/ Plugin/ EntityReferenceSelection/ DefaultSelection.php - EntityAutocomplete.php in core/
lib/ Drupal/ Core/ Entity/ Element/ EntityAutocomplete.php - ValidReferenceConstraintValidator.php in core/
lib/ Drupal/ Core/ Entity/ Plugin/ Validation/ Constraint/ ValidReferenceConstraintValidator.php
File
- core/
lib/ Drupal/ Core/ Entity/ EntityReferenceSelection/ SelectionWithAutocreateInterface.php, line 12
Namespace
Drupal\Core\Entity\EntityReferenceSelectionView source
interface SelectionWithAutocreateInterface {
/**
* Creates a new entity object that can be used as a valid reference.
*
* @param string $entity_type_id
* The entity type ID.
* @param string $bundle
* The bundle name.
* @param string $label
* The entity label.
* @param int $uid
* The entity owner ID, if the entity type supports it.
*
* @return \Drupal\Core\Entity\EntityInterface
* An unsaved entity object.
*/
public function createNewEntity($entity_type_id, $bundle, $label, $uid);
/**
* Validates which newly created entities can be referenced.
*
* This method should replicate the logic implemented by
* \Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface::validateReferenceableEntities(),
* but applied to newly created entities that have not been saved yet.
*
* @param \Drupal\Core\Entity\EntityInterface[] $entities
* An array of entities to check.
*
* @return \Drupal\Core\Entity\EntityInterface[]
* The incoming $entities parameter, filtered for valid entities. Array keys
* are preserved.
*/
public function validateReferenceableNewEntities(array $entities);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SelectionWithAutocreateInterface:: |
public | function | Creates a new entity object that can be used as a valid reference. | |
SelectionWithAutocreateInterface:: |
public | function | Validates which newly created entities can be referenced. |