Example: Forms API
Same name in other branches
- 4.0.x modules/form_api_example/form_api_example.module \form_api_example
Examples using Forms API.
Creating A Drupal Form requires:
- Creating a class that extends \Drupal\Core\Form\FormBase or \Drupal\Core\Form\ConfigFormBase
- Register the route to the form or invoke using \Drupal::formBuilder()->getForm()
In addition to the simple example described above this module provides examples that demonstrate:
- Elements used for data input -\Drupal\form_api_example\Form\InputDemo
- The order of execution of form controller methods
- Container elements used to group items
- Hiding elements based on the state of other elements
- Vertical Tabs elements in forms
- Populating a portion on a form with Ajax callbacks
- Adding additional fields to a form with Ajax callbacks
- Modal form creation
- Displaying a form in a block
End of "defgroup field_example".
Parent topics
File
-
modules/
form_api_example/ form_api_example.module, line 8
Classes
Title Sort descending | File name | Summary |
---|---|---|
AjaxColorFormTest | modules/ |
@group form_api_example |
FapiExampleTest | modules/ |
Ensure that the form_api_example forms work properly. |
ModalFormTest | modules/ |
@group form_api_example |
StateDemoTest | modules/ |
@group form_api_example |