diff --git a/components/form/introduction.rst b/components/form/introduction.rst index 28efd4ce06f..27ad2dbf0f9 100644 --- a/components/form/introduction.rst +++ b/components/form/introduction.rst @@ -17,10 +17,10 @@ be from a normal form post or from an API. Installation ------------ -You can install the component in many different ways: +You can install the component in 2 different ways: * Use the official Git repository (https://github.com/symfony/Form); -* Install it via Composer (``symfony/form`` on `Packagist`_). +* :doc:`Install it via Composer ` (``symfony/form`` on `Packagist`_). Configuration ------------- @@ -51,7 +51,8 @@ support for very important features: messages for submitted data. The Symfony2 Form component relies on other libraries to solve these problems. -Most of the time you will use Twig and the Symfony :doc:`HttpFoundation`, +Most of the time you will use Twig and the Symfony +:doc:`HttpFoundation `, Translation and Validator components, but you can replace any of these with a different library of your choice. @@ -65,10 +66,12 @@ factory. Request Handling ~~~~~~~~~~~~~~~~ -To process form data, you'll need to grab information off of the request (typically -``$_POST`` data) and pass the array of submitted data to :method:`Symfony\\Component\\Form\\Form::bind`. -The Form component optionally integrates with Symfony's :doc:`HttpFoundation` -component to make this even easier. +To process form data, you'll need to grab information off of the request +(typically ``$_POST`` data) and pass the array of submitted data to +:method:`Symfony\\Component\\Form\\Form::bind`. The Form component optionally +integrates with Symfony's +:doc:`HttpFoundation ` component to +make this even easier. To integrate the HttpFoundation component, add the :class:`Symfony\\Component\\Form\\Extension\\HttpFoundation\HttpFoundationExtension` @@ -155,7 +158,7 @@ line to your ``composer.json`` file: } } -The TwigBridge integration provides you with several :doc:`Twig Functions` +The TwigBridge integration provides you with several :doc:`Twig Functions ` that help you render each the HTML widget, label and error for each field (as well as a few other things). To configure the integration, you'll need to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension\\FormExtension`:: @@ -193,7 +196,7 @@ The exact details of your `Twig Configuration`_ will vary, but the goal is always to add the :class:`Symfony\\Bridge\\Twig\\Extension\\FormExtension` to Twig, which gives you access to the Twig functions for rendering forms. To do this, you first need to create a :class:`Symfony\\Bridge\\Twig\\Form\\TwigRendererEngine`, -where you define your :ref:`form themes` +where you define your :ref:`form themes ` (i.e. resources/files that define form HTML markup). For general details on rendering forms, see :doc:`/cookbook/form/form_customization`. @@ -219,7 +222,7 @@ with Symfony's ``Translation`` component, or add the 2 Twig filters yourself, via your own Twig extension. To use the built-in integration, be sure that your project has Symfony's -``Translation`` and :doc:`Config` components +``Translation`` and :doc:`Config ` components installed. If you're using Composer, you could get the latest 2.1 version of each of these by adding the following to your ``composer.json`` file: @@ -404,10 +407,10 @@ is created from the form factory. As you can see, creating a form is like writing a recipe: you call ``add`` for each new field you want to create. The first argument to ``add`` is the name of your field, and the second is the field "type". The Form component -comes with a lot of :doc:`built-in types`. +comes with a lot of :doc:`built-in types `. -Now that you've built your form, learn how to :ref:`render` -it and :ref:`process the form submission`. +Now that you've built your form, learn how to :ref:`render ` +it and :ref:`process the form submission `. Setting Default Values ~~~~~~~~~~~~~~~~~~~~~~ @@ -443,7 +446,7 @@ builder: .. tip:: In this example, the default data is an array. Later, when you use the - :ref:`data_class` option to bind data directly + :ref:`data_class ` option to bind data directly to objects, your default data will be an instance of that object. .. _component-form-intro-rendering-form: @@ -618,4 +621,4 @@ and the errors will display next to the fields on error. .. _Packagist: https://packagist.org/packages/symfony/form .. _Twig: http://twig.sensiolabs.org -.. _`Twig Configuration`: http://twig.sensiolabs.org/doc/intro.html \ No newline at end of file +.. _`Twig Configuration`: http://twig.sensiolabs.org/doc/intro.html