Parcourir la source

Merge pull request #653 from pulzarraider/help_message_doc

Help message documentation
Thomas il y a 13 ans
Parent
commit
33cfb4b35e
2 fichiers modifiés avec 49 ajouts et 0 suppressions
  1. 1 0
      Resources/doc/index.rst
  2. 48 0
      Resources/doc/reference/form_help_message.rst

+ 1 - 0
Resources/doc/index.rst

@@ -25,6 +25,7 @@ Reference Guide
    reference/routing
    reference/saving_hooks
    reference/form_types
+   reference/form_help_message
    reference/field_types
    reference/conditional_validation
    reference/templates

+ 48 - 0
Resources/doc/reference/form_help_message.rst

@@ -0,0 +1,48 @@
+Form Help Messages
+==========
+
+Help Messages
+------------------------
+
+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.
+
+Example
+----------------
+
+.. code-block:: php
+
+    <?php
+    class ExampleAdmin.php
+    {
+        protected function configureFormFields(FormMapper $formMapper)
+        {
+            $formMapper
+                ->with('General')
+                    ->add('title', null, array('help'=>'Set the title of a web page'))
+                    ->add('keywords', null, array('help'=>'Set the keywords of a web page'))
+                ->end();
+        }
+    }
+
+Alternative Way To Define Help Messages
+----------------
+
+.. code-block:: php
+
+    <?php
+    class ExampleAdmin.php
+    {
+        protected function configureFormFields(FormMapper $formMapper)
+        {
+            $formMapper
+                ->with('General')
+                    ->add('title')
+                    ->add('keywords')
+                    ->setHelps(array(
+                        'title' => 'Set the title of a web page',
+                        'keywords' => 'Set the keywords of a web page',
+                    ))
+                ->end();
+        }
+    }
+