Version 1
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Form / FormInterface.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\bootstrap\Plugin\Form\FormInterface.
5  */
6
7 namespace Drupal\bootstrap\Plugin\Form;
8
9 use Drupal\bootstrap\Utility\Element;
10 use Drupal\Core\Form\FormStateInterface;
11
12 /**
13  * Defines the interface for an object oriented form alter.
14  *
15  * @ingroup plugins_form
16  */
17 interface FormInterface {
18
19   /**
20    * The alter method to store the code.
21    *
22    * @param array $form
23    *   Nested array of form elements that comprises the form.
24    * @param \Drupal\Core\Form\FormStateInterface $form_state
25    *   The current state of the form.
26    * @param string $form_id
27    *   String representing the name of the form itself. Typically this is the
28    *   name of the function that generated the form.
29    */
30   public function alterForm(array &$form, FormStateInterface $form_state, $form_id = NULL);
31
32   /**
33    * The alter method to store the code.
34    *
35    * @param \Drupal\bootstrap\Utility\Element $form
36    *   The Element object that comprises the form.
37    * @param \Drupal\Core\Form\FormStateInterface $form_state
38    *   The current state of the form.
39    * @param string $form_id
40    *   String representing the name of the form itself. Typically this is the
41    *   name of the function that generated the form.
42    */
43   public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL);
44
45   /**
46    * Form validation handler.
47    *
48    * @param array $form
49    *   An associative array containing the structure of the form.
50    * @param \Drupal\Core\Form\FormStateInterface $form_state
51    *   The current state of the form.
52    */
53   public static function validateForm(array &$form, FormStateInterface $form_state);
54
55   /**
56    * Form validation handler.
57    *
58    * @param \Drupal\bootstrap\Utility\Element $form
59    *   The Element object that comprises the form.
60    * @param \Drupal\Core\Form\FormStateInterface $form_state
61    *   The current state of the form.
62    */
63   public static function validateFormElement(Element $form, FormStateInterface $form_state);
64
65   /**
66    * Form submission handler.
67    *
68    * @param array $form
69    *   An associative array containing the structure of the form.
70    * @param \Drupal\Core\Form\FormStateInterface $form_state
71    *   The current state of the form.
72    */
73   public static function submitForm(array &$form, FormStateInterface $form_state);
74
75   /**
76    * Form submission handler.
77    *
78    * @param \Drupal\bootstrap\Utility\Element $form
79    *   The Element object that comprises the form.
80    * @param \Drupal\Core\Form\FormStateInterface $form_state
81    *   The current state of the form.
82    */
83   public static function submitFormElement(Element $form, FormStateInterface $form_state);
84
85 }