Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Simplified the form theming docs#10926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions_build/redirection_map
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Binary file not shown.
13 changes: 7 additions & 6 deletionscomponents/form.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
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 DownExpand 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 DownExpand 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:`formhelper 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 deletionsform/create_custom_field_type.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -90,8 +90,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 DownExpand Up@@ -147,8 +148,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 deletionform/create_form_type_extension.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -210,7 +210,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

[8]ページ先頭

©2009-2025 Movatter.jp