4 * Contains \Drupal\bootstrap\Plugin\Form\FormInterface.
7 namespace Drupal\bootstrap\Plugin\Form;
9 use Drupal\bootstrap\Utility\Element;
10 use Drupal\Core\Form\FormStateInterface;
13 * Defines the interface for an object oriented form alter.
15 * @ingroup plugins_form
17 interface FormInterface {
20 * The alter method to store the code.
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.
30 public function alterForm(array &$form, FormStateInterface $form_state, $form_id = NULL);
33 * The alter method to store the code.
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.
43 public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL);
46 * Form validation handler.
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.
53 public static function validateForm(array &$form, FormStateInterface $form_state);
56 * Form validation handler.
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.
63 public static function validateFormElement(Element $form, FormStateInterface $form_state);
66 * Form submission handler.
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.
73 public static function submitForm(array &$form, FormStateInterface $form_state);
76 * Form submission handler.
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.
83 public static function submitFormElement(Element $form, FormStateInterface $form_state);