Upgraded drupal core with security updates
[yaffs-website] / web / core / lib / Drupal / Core / Entity / ContentEntityFormInterface.php
1 <?php
2
3 namespace Drupal\Core\Entity;
4
5 use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Defines a common interface for content entity form classes.
10  */
11 interface ContentEntityFormInterface extends EntityFormInterface {
12
13   /**
14    * Gets the form display.
15    *
16    * @param \Drupal\Core\Form\FormStateInterface $form_state
17    *   The current state of the form.
18    *
19    * @return \Drupal\Core\Entity\Display\EntityFormDisplayInterface
20    *   The current form display.
21    */
22   public function getFormDisplay(FormStateInterface $form_state);
23
24   /**
25    * Sets the form display.
26    *
27    * Sets the form display which will be used for populating form element
28    * defaults.
29    *
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.
34    *
35    * @return $this
36    */
37   public function setFormDisplay(EntityFormDisplayInterface $form_display, FormStateInterface $form_state);
38
39   /**
40    * Gets the code identifying the active form language.
41    *
42    * @param \Drupal\Core\Form\FormStateInterface $form_state
43    *   The current state of the form.
44    *
45    * @return string
46    *   The form language code.
47    */
48   public function getFormLangcode(FormStateInterface $form_state);
49
50   /**
51    * Checks whether the current form language matches the entity one.
52    *
53    * @param \Drupal\Core\Form\FormStateInterface $form_state
54    *   The current state of the form.
55    *
56    * @return bool
57    *   Returns TRUE if the entity form language matches the entity one.
58    */
59   public function isDefaultFormLangcode(FormStateInterface $form_state);
60
61   /**
62    * {@inheritdoc}
63    *
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
69    * requests.
70    * For more information about entity validation, see
71    * https://www.drupal.org/node/2015613.
72    *
73    * @return \Drupal\Core\Entity\ContentEntityTypeInterface
74    *   The built entity.
75    */
76   public function validateForm(array &$form, FormStateInterface $form_state);
77
78 }