Skip to content

Commit 9eca70c

Browse files
committed
Merge branch '2.8' into 3.2
* 2.8: minor #7613 Twig Extensions Reference minor brush-up (mpdude) Update Title in controller.rst Update scheme.rst Update requirements.rst [#7845] minor tweaks Update translation_domain.rst.inc Update page_creation.rst to correct hidden colon Update forms.rst Fixed the form types of the buttons in the Form reference Minor reword Update deployment.rst KernelTestCase::createKernel() is static, $this->createKernel() -> static::createKernel() Better explain how to enable the validation component and its annotations Fix the link to ConEmu (it is now hosted on GitHub) Add annotation examples to match a route based on the host Minor reword to improve readability Minor reword and reformatting Add security stateless tip typo
2 parents b2a0e50 + 62af2ca commit 9eca70c

19 files changed

+278
-53
lines changed

console.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ you can extend your test from
273273
{
274274
public function testExecute()
275275
{
276-
$kernel = $this->createKernel();
276+
$kernel = static::createKernel();
277277
$kernel->boot();
278278

279279
$application = new Application($kernel);

contributing/code/tests.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ what's going on and if the tests are broken because of the new code.
5555
to see colored test results.
5656

5757
.. _Cmder: http://cmder.net/
58-
.. _ConEmu: https://code.google.com/p/conemu-maximus5/
58+
.. _ConEmu: https://conemu.github.io/
5959
.. _ANSICON: https://github.com/adoxa/ansicon/releases
6060
.. _Mintty: https://mintty.github.io/

controller.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ The Symfony templating system and Twig are explained more in the
233233

234234
.. _controller-accessing-services:
235235

236-
Accessing other Services
236+
Accessing Other Services
237237
~~~~~~~~~~~~~~~~~~~~~~~~
238238

239239
Symfony comes packed with a lot of useful objects, called *services*. These

deployment.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ specifically tailored to the requirements of Symfony.
8080
`Capistrano`_ with `Symfony plugin`_
8181
`Capistrano`_ is a remote server automation and deployment tool written in Ruby.
8282
`Symfony plugin`_ is a plugin to ease Symfony related tasks, inspired by `Capifony`_
83-
(which works only with Capistrano 2 )
83+
(which works only with Capistrano 2).
8484

8585
`sf2debpkg`_
8686
Helps you build a native Debian package for your Symfony project.
@@ -181,12 +181,12 @@ setup:
181181
* Pushing assets to a CDN
182182
* ...
183183

184-
Application Lifecycle: Continuous Integration, QA, etc
185-
------------------------------------------------------
184+
Application Lifecycle: Continuous Integration, QA, etc.
185+
-------------------------------------------------------
186186

187187
While this entry covers the technical details of deploying, the full lifecycle
188-
of taking code from development up to production may have a lot more steps
189-
(think deploying to staging, QA (Quality Assurance), running tests, etc).
188+
of taking code from development up to production may have more steps:
189+
deploying to staging, QA (Quality Assurance), running tests, etc.
190190

191191
The use of staging, testing, QA, continuous integration, database migrations
192192
and the capability to roll back in case of failure are all strongly advised. There

forms.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ to do with Symfony or any other library. It's quite simply a normal PHP object
6161
that directly solves a problem inside *your* application (i.e. the need to
6262
represent a task in your application). Of course, by the end of this article,
6363
you'll be able to submit data to a ``Task`` instance (via an HTML form), validate
64-
its data, and persist it to the database.
64+
its data and persist it to the database.
6565

6666
.. index::
6767
single: Forms; Create a form in a controller
@@ -114,7 +114,7 @@ from inside a controller::
114114

115115
Creating a form requires relatively little code because Symfony form objects
116116
are built with a "form builder". The form builder's purpose is to allow you
117-
to write simple form "recipes", and have it do all the heavy-lifting of actually
117+
to write simple form "recipes" and have it do all the heavy-lifting of actually
118118
building the form.
119119

120120
In this example, you've added two fields to your form - ``task`` and ``dueDate`` -
@@ -259,7 +259,7 @@ your controller::
259259
is called. Otherwise, changes done in the ``*_SUBMIT`` events aren't applied to the
260260
view (like validation errors).
261261

262-
This controller follows a common pattern for handling forms, and has three
262+
This controller follows a common pattern for handling forms and has three
263263
possible paths:
264264

265265
#. When initially loading the page in a browser, the form is created and

introduction/from_flat_php_to_symfony2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ on the requested URI::
370370
echo '<html><body><h1>Page Not Found</h1></body></html>';
371371
}
372372

373-
For organization, both controllers (formerly ``index.php`` and ``show.php``)
373+
For organization, both controllers (formerly ``/index.php`` and ``/index.php/show``)
374374
are now PHP functions and each has been moved into a separate file named ``controllers.php``::
375375

376376
// controllers.php

page_creation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ to creating a page?
8484
in its own section, including how to make *variable* URLs;
8585

8686
#. *Create a controller*: The method below the route - ``numberAction()`` - is called
87-
the *controller*: this is a function where *you* build the page and ultimately
87+
the *controller*. This is a function where *you* build the page and ultimately
8888
return a ``Response`` object. You'll learn more about :doc:`controllers </controller>`
8989
in their own section, including how to return JSON responses.
9090

reference/configuration/security.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,13 @@ multiple firewalls, the "context" could actually be shared:
644644
),
645645
));
646646
647+
.. note::
648+
649+
The firewall context key is stored in session, so every firewall using it
650+
must set its ``stateless`` option to ``false``. Otherwise, the context is
651+
ignored and you won't be able to authenticate on multiple firewalls at the
652+
same time.
653+
647654
HTTP-Digest Authentication
648655
--------------------------
649656

reference/forms/types/button.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,21 @@ The ``BaseType`` class is the parent class for both the ``button`` type
2828
and the :doc:`FormType </reference/forms/types/form>`, but it is not part
2929
of the form type tree (i.e. it cannot be used as a form type on its own).
3030

31-
.. include:: /reference/forms/types/options/button_attr.rst.inc
31+
attr
32+
~~~~
33+
34+
**type**: ``array`` **default**: ``array()``
35+
36+
If you want to add extra attributes to the HTML representation of the button,
37+
you can use ``attr`` option. It's an associative array with HTML attribute
38+
as a key. This can be useful when you need to set a custom class for the button::
39+
40+
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
41+
// ...
42+
43+
$builder->add('save', ButtonType::class, array(
44+
'attr' => array('class' => 'save'),
45+
));
3246

3347
.. include:: /reference/forms/types/options/button_disabled.rst.inc
3448

reference/forms/types/options/button_attr.rst.inc

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
translation_domain
22
~~~~~~~~~~~~~~~~~~
33

4-
**type**: ``string`` **default**: ``messages``
4+
**type**: ``string``, ``null`` or ``false`` **default**: ``null``
55

6-
This is the translation domain that will be used for any labels or options
7-
that are rendered for this field.
6+
This is the translation domain that will be used for any label or option
7+
that is rendered for this field. Use ``null`` to reuse the translation domain
8+
of the parent form (or the default domain of the translator for the root
9+
form). Use ``false`` to disable translations.

reference/forms/types/reset.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,21 @@ A button that resets all fields to their original values.
2323
Inherited Options
2424
-----------------
2525

26-
.. include:: /reference/forms/types/options/button_attr.rst.inc
26+
attr
27+
~~~~
28+
29+
**type**: ``array`` **default**: ``array()``
30+
31+
If you want to add extra attributes to the HTML representation of the button,
32+
you can use ``attr`` option. It's an associative array with HTML attribute
33+
as a key. This can be useful when you need to set a custom class for the button::
34+
35+
use Symfony\Component\Form\Extension\Core\Type\ResetType;
36+
// ...
37+
38+
$builder->add('save', ResetType::class, array(
39+
'attr' => array('class' => 'save'),
40+
));
2741

2842
.. include:: /reference/forms/types/options/button_disabled.rst.inc
2943

reference/forms/types/submit.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,21 @@ useful when :doc:`a form has multiple submit buttons </form/multiple_buttons>`::
3434
Inherited Options
3535
-----------------
3636

37-
.. include:: /reference/forms/types/options/button_attr.rst.inc
37+
attr
38+
~~~~
39+
40+
**type**: ``array`` **default**: ``array()``
41+
42+
If you want to add extra attributes to the HTML representation of the button,
43+
you can use ``attr`` option. It's an associative array with HTML attribute
44+
as a key. This can be useful when you need to set a custom class for the button::
45+
46+
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
47+
// ...
48+
49+
$builder->add('save', SubmitType::class, array(
50+
'attr' => array('class' => 'save'),
51+
));
3852

3953
.. include:: /reference/forms/types/options/button_disabled.rst.inc
4054

reference/twig_reference.rst

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,32 @@ Symfony Twig Extensions
77
=======================
88

99
Twig is the default template engine for Symfony. By itself, it already contains
10-
a lot of built-in functions, filters, tags and tests (learn more about them
11-
from the `Twig Reference`_).
10+
a lot of built-in functions, filters, tags and tests. You can learn more about
11+
them from the `Twig Reference`_.
1212

13-
Symfony adds custom extensions on top of Twig to integrate some components
14-
into the Twig templates. The following sections describe the custom
15-
:ref:`functions <reference-twig-functions>`, :ref:`filters <reference-twig-filters>`,
16-
:ref:`tags <reference-twig-tags>` and :ref:`tests <reference-twig-tests>`
17-
that are available when using the Symfony Core Framework.
13+
The Symfony framework adds quite a few extra :ref:`functions <reference-twig-functions>`,
14+
:ref:`filters <reference-twig-filters>`, :ref:`tags <reference-twig-tags>`
15+
and :ref:`tests <reference-twig-tests>` to seamlessly integrate the
16+
various Symfony components with Twig templates. The following sections
17+
describe these extra features.
1818

19-
There may also be tags in bundles you use that aren't listed here.
19+
.. tip::
20+
21+
  Technically, most of the extensions live in the `Twig Bridge`_. That code
22+
might give you some ideas when you need to write your own Twig extension
23+
as described in :doc:`/templating/twig_extension`.
24+
25+
.. note::
26+
27+
This reference only covers the Twig extensions provided by the Symfony
28+
framework. You are probably using some other bundles as well, and
29+
those might come with their own extensions not covered here.
30+
31+
.. tip::
32+
33+
  The `Twig Extensions repository`_ contains some additional Twig extensions
34+
that do not belong to the Twig core, so you might want to have a look at
35+
the `Twig Extensions documentation`_.
2036

2137
.. _reference-twig-functions:
2238

@@ -727,8 +743,11 @@ Symfony Standard Edition Extensions
727743
The Symfony Standard Edition adds some bundles to the Symfony Core Framework.
728744
Those bundles can have other Twig extensions:
729745

730-
* **Twig Extensions** includes some interesting extensions that do not belong
731-
to the Twig core. You can read more in `the official Twig Extensions documentation`_.
746+
* **Assetic** adds the ``{% stylesheets %}``, ``{% javascripts %}`` and
747+
``{% image %}`` tags. You can read more about them in
748+
:doc:`the Assetic Documentation </assetic/asset_management>`.
732749

733750
.. _`Twig Reference`: http://twig.sensiolabs.org/documentation#reference
734-
.. _`the official Twig Extensions documentation`: http://twig-extensions.readthedocs.io/
751+
.. _`Twig Extensions repository`: https://github.com/twigphp/Twig-extensions
752+
.. _`Twig Extensions documentation`: http://twig-extensions.readthedocs.io/en/latest/
753+
.. _`Twig Bridge`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bridge/Twig/Extension

0 commit comments

Comments
 (0)