Browse Source

Add documentation and fix code review warning

Tom Adam 12 years ago
parent
commit
5302d917cc
2 changed files with 27 additions and 6 deletions
  1. 0 1
      Form/FormMapper.php
  2. 27 5
      Resources/doc/reference/form_help_message.rst

+ 0 - 1
Form/FormMapper.php

@@ -12,7 +12,6 @@ namespace Sonata\AdminBundle\Form;
 
 
 use Sonata\AdminBundle\Builder\FormContractorInterface;
 use Sonata\AdminBundle\Builder\FormContractorInterface;
 use Sonata\AdminBundle\Admin\AdminInterface;
 use Sonata\AdminBundle\Admin\AdminInterface;
-use Sonata\AdminBundle\Admin\FieldDescriptionInterface;
 use Symfony\Component\Form\FormBuilder;
 use Symfony\Component\Form\FormBuilder;
 
 
 /**
 /**

+ 27 - 5
Resources/doc/reference/form_help_message.rst

@@ -1,13 +1,13 @@
-Form Help Messages
-==================
+Form Help Messages and Descriptions
+===================================
 
 
 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.
+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. The text is not escaped, so HTML can be used.
 
 
 Example
 Example
--------
+^^^^^^^
 
 
 .. code-block:: php
 .. code-block:: php
 
 
@@ -25,7 +25,7 @@ Example
     }
     }
 
 
 Alternative Way To Define Help Messages
 Alternative Way To Define Help Messages
----------------------------------------
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 
 .. code-block:: php
 .. code-block:: php
 
 
@@ -46,3 +46,25 @@ Alternative Way To Define Help Messages
         }
         }
     }
     }
 
 
+Form Group Descriptions
+-----------------------
+
+A form group description is a block of text rendered below the group title. These can be used to describe a section of a form. The text is not escaped, so HTML can be used.
+
+Example
+^^^^^^^
+
+.. code-block:: php
+
+    <?php
+    class ExampleAdmin.php
+    {
+        protected function configureFormFields(FormMapper $formMapper)
+        {
+            $formMapper
+                ->with('General', array('description' => 'This section contains general settings for the web page'))
+                    ->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();
+        }
+    }