Browse Source

Merge pull request #653 from pulzarraider/help_message_doc

Help message documentation
Thomas 13 năm trước cách đây
mục cha
commit
33cfb4b35e
2 tập tin đã thay đổi với 49 bổ sung0 xóa
  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();
+        }
+    }
+