interface EntityFormInterface
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityFormInterface.php \Drupal\Core\Entity\EntityFormInterface
- 10 core/lib/Drupal/Core/Entity/EntityFormInterface.php \Drupal\Core\Entity\EntityFormInterface
- 11.x core/lib/Drupal/Core/Entity/EntityFormInterface.php \Drupal\Core\Entity\EntityFormInterface
Defines an interface for entity form classes.
Hierarchy
- interface \Drupal\Core\Form\FormInterface
- interface \Drupal\Core\Form\BaseFormIdInterface extends \Drupal\Core\Form\FormInterface
- interface \Drupal\Core\Entity\EntityFormInterface extends \Drupal\Core\Form\BaseFormIdInterface
- interface \Drupal\Core\Form\BaseFormIdInterface extends \Drupal\Core\Form\FormInterface
Expanded class hierarchy of EntityFormInterface
All classes that implement EntityFormInterface
3 files declare their use of EntityFormInterface
- EntityManagerTest.php in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityManagerTest.php - language.module in core/
modules/ language/ language.module - Add language handling functionality to Drupal.
- workspaces.module in core/
modules/ workspaces/ workspaces.module - Provides full-site preview functionality for content staging.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityFormInterface.php, line 14
Namespace
Drupal\Core\EntityView source
interface EntityFormInterface extends BaseFormIdInterface {
/**
* Sets the operation for this form.
*
* @param string $operation
* The name of the current operation.
*
* @return $this
*/
public function setOperation($operation);
/**
* Gets the operation identifying the form.
*
* @return string
* The name of the operation.
*/
public function getOperation();
/**
* Gets the form entity.
*
* The form entity which has been used for populating form element defaults.
*
* @return \Drupal\Core\Entity\EntityInterface
* The current form entity.
*/
public function getEntity();
/**
* Sets the form entity.
*
* Sets the form entity which will be used for populating form element
* defaults. Usually, the form entity gets updated by
* \Drupal\Core\Entity\EntityFormInterface::submit(), however this may
* be used to completely exchange the form entity, e.g. when preparing the
* rebuild of a multi-step form.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity the current form should operate upon.
*
* @return $this
*/
public function setEntity(EntityInterface $entity);
/**
* Determines which entity will be used by this form from a RouteMatch object.
*
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match.
* @param string $entity_type_id
* The entity type identifier.
*
* @return \Drupal\Core\Entity\EntityInterface
* The entity object as determined from the passed-in route match.
*/
public function getEntityFromRouteMatch(RouteMatchInterface $route_match, $entity_type_id);
/**
* Builds an updated entity object based upon the submitted form values.
*
* For building the updated entity object the form's entity is cloned and
* the submitted form values are copied to entity properties. The form's
* entity remains unchanged.
*
* @see \Drupal\Core\Entity\EntityFormInterface::getEntity()
*
* @param array $form
* A nested array form elements comprising the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @return \Drupal\Core\Entity\EntityInterface
* An updated copy of the form's entity object.
*/
public function buildEntity(array $form, FormStateInterface $form_state);
/**
* Form submission handler for the 'save' action.
*
* Normally this method should be overridden to provide specific messages to
* the user and redirect the form after the entity has been saved.
*
* @param array $form
* An associative array containing the structure of the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @return int
* Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed.
*/
public function save(array $form, FormStateInterface $form_state);
/**
* Sets the string translation service for this form.
*
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The translation manager.
*
* @return $this
*/
public function setStringTranslation(TranslationInterface $string_translation);
/**
* Sets the module handler for this form.
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
*
* @return $this
*/
public function setModuleHandler(ModuleHandlerInterface $module_handler);
/**
* Sets the entity manager for this form.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
*
* @return $this
*
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use
* EntityFormInterface::setEntityTypeManager() instead.
*
* @see https://www.drupal.org/node/2549139
*/
public function setEntityManager(EntityManagerInterface $entity_manager);
/**
* Sets the entity type manager for this form.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*
* @return $this
*/
public function setEntityTypeManager(EntityTypeManagerInterface $entity_type_manager);
}
Members
Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|---|
BaseFormIdInterface::getBaseFormId | public | function | Returns a string identifying the base form. | 5 | |
EntityFormInterface::buildEntity | public | function | Builds an updated entity object based upon the submitted form values. | 1 | |
EntityFormInterface::getEntity | public | function | Gets the form entity. | 1 | |
EntityFormInterface::getEntityFromRouteMatch | public | function | Determines which entity will be used by this form from a RouteMatch object. | 1 | |
EntityFormInterface::getOperation | public | function | Gets the operation identifying the form. | 1 | |
EntityFormInterface::save | public | function | Form submission handler for the 'save' action. | 1 | |
EntityFormInterface::setEntity | public | function | Sets the form entity. | 1 | |
EntityFormInterface::setEntityManager | Deprecated | public | function | Sets the entity manager for this form. | 1 |
EntityFormInterface::setEntityTypeManager | public | function | Sets the entity type manager for this form. | 1 | |
EntityFormInterface::setModuleHandler | public | function | Sets the module handler for this form. | 1 | |
EntityFormInterface::setOperation | public | function | Sets the operation for this form. | 1 | |
EntityFormInterface::setStringTranslation | public | function | Sets the string translation service for this form. | ||
FormInterface::buildForm | public | function | Form constructor. | 191 | |
FormInterface::getFormId | public | function | Returns a unique string identifying the form. | 264 | |
FormInterface::submitForm | public | function | Form submission handler. | 213 | |
FormInterface::validateForm | public | function | Form validation handler. | 30 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.