interface ContentEntityFormInterface

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityFormInterface.php \Drupal\Core\Entity\ContentEntityFormInterface
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityFormInterface.php \Drupal\Core\Entity\ContentEntityFormInterface
  3. 11.x core/lib/Drupal/Core/Entity/ContentEntityFormInterface.php \Drupal\Core\Entity\ContentEntityFormInterface

Defines a common interface for content entity form classes.

Hierarchy

Expanded class hierarchy of ContentEntityFormInterface

All classes that implement ContentEntityFormInterface

4 files declare their use of ContentEntityFormInterface
content_translation.module in core/modules/content_translation/content_translation.module
Allows entities to be translated into different languages.
EntityTypeInfo.php in core/modules/content_moderation/src/EntityTypeInfo.php
field_layout.module in core/modules/field_layout/field_layout.module
Provides hook implementations for Field Layout.
language.module in core/modules/language/language.module
Add language handling functionality to Drupal.

File

core/lib/Drupal/Core/Entity/ContentEntityFormInterface.php, line 11

Namespace

Drupal\Core\Entity
View source
interface ContentEntityFormInterface extends EntityFormInterface {
    
    /**
     * Gets the form display.
     *
     * @param \Drupal\Core\Form\FormStateInterface $form_state
     *   The current state of the form.
     *
     * @return \Drupal\Core\Entity\Display\EntityFormDisplayInterface
     *   The current form display.
     */
    public function getFormDisplay(FormStateInterface $form_state);
    
    /**
     * Sets the form display.
     *
     * Sets the form display which will be used for populating form element
     * defaults.
     *
     * @param \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display
     *   The form display that the current form operates with.
     * @param \Drupal\Core\Form\FormStateInterface $form_state
     *   The current state of the form.
     *
     * @return $this
     */
    public function setFormDisplay(EntityFormDisplayInterface $form_display, FormStateInterface $form_state);
    
    /**
     * Gets the code identifying the active form language.
     *
     * @param \Drupal\Core\Form\FormStateInterface $form_state
     *   The current state of the form.
     *
     * @return string
     *   The form language code.
     */
    public function getFormLangcode(FormStateInterface $form_state);
    
    /**
     * Checks whether the current form language matches the entity one.
     *
     * @param \Drupal\Core\Form\FormStateInterface $form_state
     *   The current state of the form.
     *
     * @return bool
     *   Returns TRUE if the entity form language matches the entity one.
     */
    public function isDefaultFormLangcode(FormStateInterface $form_state);
    
    /**
     * {@inheritdoc}
     *
     * Note that extending classes should not override this method to add entity
     * validation logic, but define further validation constraints using the
     * entity validation API and/or provide a new validation constraint if
     * necessary. This is the only way to ensure that the validation logic
     * is correctly applied independently of form submissions; e.g., for REST
     * requests.
     * For more information about entity validation, see
     * https://www.drupal.org/node/2015613.
     *
     * @return \Drupal\Core\Entity\ContentEntityInterface
     *   The built entity.
     */
    public function validateForm(array &$form, FormStateInterface $form_state);

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
BaseFormIdInterface::getBaseFormId public function Returns a string identifying the base form. 7
ContentEntityFormInterface::getFormDisplay public function Gets the form display. 1
ContentEntityFormInterface::getFormLangcode public function Gets the code identifying the active form language. 1
ContentEntityFormInterface::isDefaultFormLangcode public function Checks whether the current form language matches the entity one. 1
ContentEntityFormInterface::setFormDisplay public function Sets the form display. 1
ContentEntityFormInterface::validateForm public function Note that extending classes should not override this method to add entity
validation logic, but define further validation constraints using the
entity validation API and/or provide a new validation constraint if
necessary. This is the only way to…
Overrides FormInterface::validateForm
EntityFormInterface::buildEntity public function Builds an updated entity object based upon the submitted form values. 3
EntityFormInterface::getEntity public function Gets the form entity. 3
EntityFormInterface::getEntityFromRouteMatch public function Determines which entity will be used by this form from a RouteMatch object. 3
EntityFormInterface::getOperation public function Gets the operation identifying the form. 3
EntityFormInterface::save public function Form submission handler for the 'save' action. 3
EntityFormInterface::setEntity public function Sets the form entity. 3
EntityFormInterface::setEntityTypeManager public function Sets the entity type manager for this form. 3
EntityFormInterface::setModuleHandler public function Sets the module handler for this form. 3
EntityFormInterface::setOperation public function Sets the operation for this form. 3
EntityFormInterface::setStringTranslation public function Sets the string translation service for this form.
FormInterface::buildForm public function Form constructor. 203
FormInterface::getFormId public function Returns a unique string identifying the form. 284
FormInterface::submitForm public function Form submission handler. 229

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