file FormInterface.php

Namespace

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

Interfaces

Name Description
FormInterface Defines the interface for an object oriented form alter.