Skip to content

Commit

Permalink
Merge branch '4.2'
Browse files Browse the repository at this point in the history
* 4.2:
  Simplified the form theming docs
  MakerBundle uses urlGenerator instead of Router
  Update filesystem.rst
  Update form_dependencies.rst
  Fix encore advanced config watchOptions example
  [WebLink] Add an example using Priority Hints
  form_help description added
  Update form.rst
  Use "number" instead of "numeric"
  Update Range.rst
  • Loading branch information
javiereguiluz committed Jan 25, 2019
2 parents e0f44de + e0f9dbe commit 5bb148e
Show file tree
Hide file tree
Showing 22 changed files with 867 additions and 1,673 deletions.
2 changes: 2 additions & 0 deletions _build/redirection_map
Original file line number Diff line number Diff line change
Expand Up @@ -403,3 +403,5 @@
/frontend/encore/installation-no-flex /frontend/encore/installation
/http_cache/form_csrf_caching /security/csrf
/console/logging /console
/reference/forms/twig_reference /form/form_customization
/form/rendering /form/form_customization
1 change: 1 addition & 0 deletions _images/form/form-field-parts.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/sources/form/form-field-parts.dia
Binary file not shown.
8 changes: 8 additions & 0 deletions components/filesystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,14 @@ isAbsolutePath
// returns false
$fileSystem->isAbsolutePath('../dir');

tempnam
~~~~~~~

:method:`Symfony\\Component\\Filesystem\\Filesystem::tempnam` creates a temporary file with a unique filename, and returns its path, or throw an exception on failure::

// returns a path like : /tmp/prefix_wyjgtF
$filesystem->tempnam('/tmp', 'prefix_');

dumpFile
~~~~~~~~

Expand Down
17 changes: 9 additions & 8 deletions components/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ support for very important features:
The Symfony Form component relies on other libraries to solve these problems.
Most of the time you will use Twig and the Symfony
:doc:`HttpFoundation </components/http_foundation>`,
Translation and Validator components, but you can replace any of these with
a different library of your choice.
:doc:`Translation </components/translation>` and :doc:`Validator </components/validator>`
components, but you can replace any of these with a different library of your choice.

The following sections explain how to plug these libraries into the form
factory.
Expand Down Expand Up @@ -177,8 +177,9 @@ between Twig and several Symfony components:
$ composer require symfony/twig-bridge
The TwigBridge integration provides you with several :doc:`Twig Functions </reference/forms/twig_reference>`
that help you render the HTML widget, label and error for each field
The TwigBridge integration provides you with several
:ref:`Twig Functions <reference-form-twig-functions-variables>`
that help you render the HTML widget, label, help and errors 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`::

Expand Down Expand Up @@ -231,7 +232,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 <form-customization-form-themes>`
where you define your :doc:`form themes </form/form_themes>`
(i.e. resources/files that define form HTML markup).

For general details on rendering forms, see :doc:`/form/form_customization`.
Expand Down Expand Up @@ -510,8 +511,8 @@ Rendering the Form

Now that the form has been created, the next step is to render it. This is
done by passing a special form "view" object to your template (notice the
``$form->createView()`` in the controller above) and using a set of form
helper functions:
``$form->createView()`` in the controller above) and using a set of
:ref:`form helper functions <reference-form-twig-functions>`:

.. code-block:: html+twig

Expand All @@ -528,7 +529,7 @@ That's it! By printing ``form_widget(form)``, each field in the form is
rendered, along with a label and error message (if there is one). While this is
convenient, it's not very flexible (yet). Usually, you'll want to render each
form field individually so you can control how the form looks. You'll learn how
to do that in the ":doc:`/form/rendering`" section.
to do that in the :doc:`form customization </form/form_customization>` article.

Changing a Form's Method and Action
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
9 changes: 5 additions & 4 deletions form/create_custom_field_type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ shipping options.
Creating a Template for the Field
---------------------------------

Each field type is rendered by a template fragment, which is determined in part by
the class name of your type. For more information, see :ref:`form-customization-form-themes`.
Each field type is rendered by a template fragment whose name is determined in
part by the class name of your type. Read the :ref:`from fragment naming <form-fragment-naming>`
rules for more details.

.. note::

Expand Down Expand Up @@ -168,8 +169,8 @@ link for details), create a ``shipping_widget`` block to handle this:
.. note::

Make sure the correct widget prefix is used. In this example the name should
be ``shipping_widget`` (see :ref:`form-customization-form-themes`).
Further, the main config file should point to the custom form template
be ``shipping_widget`` (see :ref:`form fragment naming <form-fragment-naming>`
rules). Further, the main config file should point to the custom form template
so that it's used when rendering all forms.

When using Twig this is:
Expand Down
2 changes: 1 addition & 1 deletion form/create_form_type_extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Override the File Widget Template Fragment

Each field type is rendered by a template fragment. Those template fragments
can be overridden in order to customize form rendering. For more information,
you can refer to the :ref:`form-customization-form-themes` article.
you can refer to the :ref:`form fragment naming <form-fragment-naming>` rules.

In your extension class, you added a new variable (``image_url``), but
you still need to take advantage of this new variable in your templates.
Expand Down
Loading

0 comments on commit 5bb148e

Please sign in to comment.