form_help_message.rst 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. Form Help Messages
  2. ==========
  3. About Help messages
  4. ------------------------
  5. Help messages are short notes that are rendered together with form fields. They are generally used to show additional information so the user can complete the form-element faster and more accurately.
  6. Example
  7. ----------------
  8. .. code-block:: php
  9. <?php
  10. class ExampleAdmin.php
  11. {
  12. protected function configureFormFields(FormMapper $formMapper)
  13. {
  14. $formMapper
  15. ->with('General')
  16. ->add('title', null, array('help'=>'Set the title of a web page'))
  17. ->add('keywords', null, array('help'=>'Set the keywords of a web page'))
  18. ->end();
  19. }
  20. }
  21. Alternative way to define help message
  22. ----------------
  23. .. code-block:: php
  24. <?php
  25. class ExampleAdmin.php
  26. {
  27. protected function configureFormFields(FormMapper $formMapper)
  28. {
  29. $formMapper
  30. ->with('General')
  31. ->add('title')
  32. ->add('keywords')
  33. ->setHelps(array(
  34. 'title' => 'Set the title of a web page',
  35. 'keywords' => 'Set the keywords of a web page',
  36. ))
  37. ->end();
  38. }
  39. }