3 namespace Drupal\Core\Entity;
5 use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
6 use Drupal\Core\Form\FormStateInterface;
9 * Defines a common interface for content entity form classes.
11 interface ContentEntityFormInterface extends EntityFormInterface {
14 * Gets the form display.
16 * @param \Drupal\Core\Form\FormStateInterface $form_state
17 * The current state of the form.
19 * @return \Drupal\Core\Entity\Display\EntityFormDisplayInterface
20 * The current form display.
22 public function getFormDisplay(FormStateInterface $form_state);
25 * Sets the form display.
27 * Sets the form display which will be used for populating form element
30 * @param \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display
31 * The form display that the current form operates with.
32 * @param \Drupal\Core\Form\FormStateInterface $form_state
33 * The current state of the form.
37 public function setFormDisplay(EntityFormDisplayInterface $form_display, FormStateInterface $form_state);
40 * Gets the code identifying the active form language.
42 * @param \Drupal\Core\Form\FormStateInterface $form_state
43 * The current state of the form.
46 * The form language code.
48 public function getFormLangcode(FormStateInterface $form_state);
51 * Checks whether the current form language matches the entity one.
53 * @param \Drupal\Core\Form\FormStateInterface $form_state
54 * The current state of the form.
57 * Returns TRUE if the entity form language matches the entity one.
59 public function isDefaultFormLangcode(FormStateInterface $form_state);
64 * Note that extending classes should not override this method to add entity
65 * validation logic, but define further validation constraints using the
66 * entity validation API and/or provide a new validation constraint if
67 * necessary. This is the only way to ensure that the validation logic
68 * is correctly applied independently of form submissions; e.g., for REST
70 * For more information about entity validation, see
71 * https://www.drupal.org/node/2015613.
73 * @return \Drupal\Core\Entity\ContentEntityTypeInterface
76 public function validateForm(array &$form, FormStateInterface $form_state);