Drupal Course 2013 - Form API

1,151 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,151
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
7
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Drupal Course 2013 - Form API

  1. 1. Form API Attila Cs. Nagy March 14, 2013Tuesday, March 26, 13
  2. 2. HTML form tagTuesday, March 26, 13
  3. 3. form tag • <input> • <textarea> • <button> • <select> • <option> • ...Tuesday, March 26, 13
  4. 4. Why are we loving APIs?Tuesday, March 26, 13
  5. 5. API • Reusability • Standard solutions • Encapsulation • Connection pointTuesday, March 26, 13
  6. 6. hook systemTuesday, March 26, 13
  7. 7. Tuesday, March 26, 13
  8. 8. module fooTuesday, March 26, 13
  9. 9. module foo hook_barTuesday, March 26, 13
  10. 10. module foo function foo_bar() { hook_barTuesday, March 26, 13
  11. 11. Form API http://api.drupal.org/api/drupal/developer%21topics %21forms_api_reference.html/7Tuesday, March 26, 13
  12. 12. Form API • Generate HTML • Handle security issues • Validation • Ajax • StatesTuesday, March 26, 13
  13. 13. Form APITuesday, March 26, 13
  14. 14. Examples module form_example http://drupal.org/project/examplesTuesday, March 26, 13
  15. 15. How does it work?Tuesday, March 26, 13
  16. 16. hook_menu http://api.drupal.org/api/drupal/modules%21system %21system.api.php/function/hook_menu/7Tuesday, March 26, 13
  17. 17. drupal_get_form($form_id); http://api.drupal.org/api/drupal/includes%21form.inc/ function/drupal_get_form/7Tuesday, March 26, 13
  18. 18. $form_stateTuesday, March 26, 13
  19. 19. Tuesday, March 26, 13
  20. 20. ValidationTuesday, March 26, 13
  21. 21. Validation $form_id_validate($form, &$form_state) {Tuesday, March 26, 13
  22. 22. #element_validateTuesday, March 26, 13
  23. 23. submit handlingTuesday, March 26, 13
  24. 24. $form_id_submit($form, &$form_state) {Tuesday, March 26, 13
  25. 25. hook_form_alter http://api.drupal.org/api/drupal/modules%21system %21system.api.php/function/hook_form_alter/7Tuesday, March 26, 13
  26. 26. States API http://api.drupal.org/api/examples/form_example %21form_example_states.inc/function/Tuesday, March 26, 13
  27. 27. system_settings_form http://api.drupal.org/api/drupal/modules!system! system.module/function/system_settings_form/7Tuesday, March 26, 13
  28. 28. hook_element_info http://api.drupal.org/api/drupal/modules%21system %21system.api.php/function/hook_element_info/7Tuesday, March 26, 13
  29. 29. Questions?Tuesday, March 26, 13
  30. 30. Tuesday, March 26, 13

×