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

Appearance settings

Commit 6ba90ec

Browse filesBrowse files
committed
Merge branch '2.5' into 2.6
* 2.5: [#4928] Backporting change after merging into 2.5 (since 2.3 is a little different) Update introduction.rst Change installation method order Add missing comma in array Fix typos Remove block which doesn't make sense after best practices Fixed a minor RST syntax issue Added a reference about including JS and CSS files in PHP templates Removed the Stable API chapter from the Symfony book
2 parents 6be214c + 169315b commit 6ba90ec
Copy full SHA for 6ba90ec

File tree

Expand file treeCollapse file tree

9 files changed

+62
-129
lines changed
Filter options
Expand file treeCollapse file tree

9 files changed

+62
-129
lines changed

‎book/index.rst

Copy file name to clipboardExpand all lines: book/index.rst
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ The Book
2222
service_container
2323
performance
2424
internals
25-
stable_api
2625

2726
.. include:: /book/map.rst.inc

‎book/map.rst.inc

Copy file name to clipboardExpand all lines: book/map.rst.inc
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@
1616
* :doc:`/book/service_container`
1717
* :doc:`/book/performance`
1818
* :doc:`/book/internals`
19-
* :doc:`/book/stable_api`

‎book/stable_api.rst

Copy file name to clipboardExpand all lines: book/stable_api.rst
-56Lines changed: 0 additions & 56 deletions
This file was deleted.

‎book/templating.rst

Copy file name to clipboardExpand all lines: book/templating.rst
+57-24Lines changed: 57 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,43 +1091,76 @@ one called ``stylesheets`` inside the ``head`` tag and another called ``javascri
10911091
just above the closing ``body`` tag. These blocks will contain all of the
10921092
stylesheets and JavaScripts that you'll need throughout your site:
10931093

1094-
.. code-block:: html+jinja
1094+
.. configuration-block::
10951095

1096-
{# app/Resources/views/base.html.twig #}
1097-
<html>
1098-
<head>
1099-
{# ... #}
1096+
.. code-block:: html+jinja
11001097

1101-
{% block stylesheets %}
1102-
<link href="{{ asset('css/main.css') }}" rel="stylesheet" />
1103-
{% endblock %}
1104-
</head>
1105-
<body>
1106-
{# ... #}
1098+
{# app/Resources/views/base.html.twig #}
1099+
<html>
1100+
<head>
1101+
{# ... #}
11071102

1108-
{% block javascripts %}
1109-
<script src="{{ asset('js/main.js') }}"></script>
1110-
{% endblock %}
1111-
</body>
1112-
</html>
1103+
{% block stylesheets %}
1104+
<link href="{{ asset('css/main.css') }}" rel="stylesheet" />
1105+
{% endblock %}
1106+
</head>
1107+
<body>
1108+
{# ... #}
1109+
1110+
{% block javascripts %}
1111+
<script src="{{ asset('js/main.js') }}"></script>
1112+
{% endblock %}
1113+
</body>
1114+
</html>
1115+
1116+
.. code-block:: php
1117+
1118+
// app/Resources/views/base.html.php
1119+
<html>
1120+
<head>
1121+
<?php ... ?>
1122+
1123+
<?php $view['slots']->start('stylesheets') ?>
1124+
<link href="<?php echo $view['assets']->getUrl('css/main.css') ?>" rel="stylesheet" />
1125+
<?php $view['slots']->stop() ?>
1126+
</head>
1127+
<body>
1128+
<?php ... ?>
1129+
1130+
<?php $view['slots']->start('javascripts') ?>
1131+
<script src="<?php echo $view['assets']->getUrl('js/main.js') ?>"></script>
1132+
<?php $view['slots']->stop() ?>
1133+
</body>
1134+
</html>
11131135
11141136
That's easy enough! But what if you need to include an extra stylesheet or
11151137
JavaScript from a child template? For example, suppose you have a contact
11161138
page and you need to include a ``contact.css`` stylesheet *just* on that
11171139
page. From inside that contact page's template, do the following:
11181140

1119-
.. code-block:: html+jinja
1141+
.. configuration-block::
1142+
1143+
.. code-block:: html+jinja
1144+
1145+
{# app/Resources/views/Contact/contact.html.twig #}
1146+
{% extends 'base.html.twig' %}
1147+
1148+
{% block stylesheets %}
1149+
{{ parent() }}
1150+
1151+
<link href="{{ asset('css/contact.css') }}" rel="stylesheet" />
1152+
{% endblock %}
11201153

1121-
{# app/Resources/views/Contact/contact.html.twig #}
1122-
{% extends 'base.html.twig' %}
1154+
{# ... #}
11231155

1124-
{% block stylesheets %}
1125-
{{ parent() }}
1156+
.. code-block:: php
11261157
1127-
<link href="{{ asset('css/contact.css') }}" rel="stylesheet" />
1128-
{% endblock %}
1158+
// app/Resources/views/Contact/contact.html.twig
1159+
<?php $view->extend('base.html.php') ?>
11291160
1130-
{# ... #}
1161+
<?php $view['slots']->start('stylesheets') ?>
1162+
<link href="<?php echo $view['assets']->getUrl('css/contact.css') ?>" rel="stylesheet" />
1163+
<?php $view['slots']->stop() ?>
11311164
11321165
In the child template, you simply override the ``stylesheets`` block and
11331166
put your new stylesheet tag inside of that block. Of course, since you want

‎components/debug/introduction.rst

Copy file name to clipboardExpand all lines: components/debug/introduction.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Installation
1616

1717
You can install the component in many different ways:
1818

19-
* Use the official Git repository (https://github.com/symfony/Debug);
20-
* :doc:`Install it via Composer </components/using_components>` (``symfony/debug`` on `Packagist`_).
19+
* :doc:`Install it via Composer </components/using_components>` (``symfony/debug`` on `Packagist`_);
20+
* Use the official Git repository (https://github.com/symfony/Debug).
2121

2222
Usage
2323
-----

‎components/dependency_injection/parameters.rst

Copy file name to clipboardExpand all lines: components/dependency_injection/parameters.rst
-43Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -140,49 +140,6 @@ rather than being tied up and hidden with the service definition:
140140
If you were using this elsewhere as well, then you would only need to change
141141
the parameter value in one place if needed.
142142

143-
You can also use the parameters in the service definition, for example,
144-
making the class of a service a parameter:
145-
146-
.. configuration-block::
147-
148-
.. code-block:: yaml
149-
150-
parameters:
151-
mailer.transport: sendmail
152-
153-
services:
154-
mailer:
155-
class: Mailer
156-
arguments: ["%mailer.transport%"]
157-
158-
.. code-block:: xml
159-
160-
<?xml version="1.0" encoding="UTF-8" ?>
161-
<container xmlns="http://symfony.com/schema/dic/services"
162-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
163-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
164-
165-
<parameters>
166-
<parameter key="mailer.transport">sendmail</parameter>
167-
</parameters>
168-
169-
<services>
170-
<service id="mailer" class="Mailer">
171-
<argument>%mailer.transport%</argument>
172-
</service>
173-
</services>
174-
</container>
175-
176-
.. code-block:: php
177-
178-
use Symfony\Component\DependencyInjection\Reference;
179-
180-
$container->setParameter('mailer.transport', 'sendmail');
181-
182-
$container
183-
->register('mailer', 'Mailer')
184-
->addArgument('%mailer.transport%');
185-
186143
.. note::
187144

188145
The percent sign inside a parameter or argument, as part of the string, must

‎components/serializer.rst

Copy file name to clipboardExpand all lines: components/serializer.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ of the ``Person`` class would be encoded in XML format::
153153
</person>
154154
EOF;
155155

156-
$person = $serializer->deserialize($data,'Acme\Person','xml');
156+
$person = $serializer->deserialize($data, 'Acme\Person', 'xml');
157157

158158
In this case, :method:`Symfony\\Component\\Serializer\\Serializer::deserialize`
159159
needs three parameters:

‎components/templating/introduction.rst

Copy file name to clipboardExpand all lines: components/templating/introduction.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ method is used.
196196
197197
$templating = new DelegatingEngine(array(
198198
new PhpEngine(...),
199-
new CustomEngine(...)
199+
new CustomEngine(...),
200200
));
201201
202202
.. _Packagist: https://packagist.org/packages/symfony/templating

‎redirection_map

Copy file name to clipboardExpand all lines: redirection_map
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/book/stable_api /contributing/code/bc
12
/cookbook/deployment-tools /cookbook/deployment/tools
23
/cookbook/doctrine/migrations /bundles/DoctrineFixturesBundle/index
34
/cookbook/doctrine/doctrine_fixtures /bundles/DoctrineFixturesBundle/index

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.