Skip to content

Commit

Permalink
Merge branch '2.7'
Browse files Browse the repository at this point in the history
* 2.7:
  [#4928] Backporting change after merging into 2.5 (since 2.3 is a little different)
  Update introduction.rst
  Change installation method order
  Fix typos
  Add missing comma in array
  Fix typos
  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
  • Loading branch information
weaverryan committed Feb 1, 2015
2 parents ef39a01 + 70902f5 commit 81e8c13
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 131 deletions.
1 change: 0 additions & 1 deletion book/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ The Book
service_container
performance
internals
stable_api

.. include:: /book/map.rst.inc
1 change: 0 additions & 1 deletion book/map.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@
* :doc:`/book/service_container`
* :doc:`/book/performance`
* :doc:`/book/internals`
* :doc:`/book/stable_api`
56 changes: 0 additions & 56 deletions book/stable_api.rst

This file was deleted.

81 changes: 57 additions & 24 deletions book/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1085,43 +1085,76 @@ one called ``stylesheets`` inside the ``head`` tag and another called ``javascri
just above the closing ``body`` tag. These blocks will contain all of the
stylesheets and JavaScripts that you'll need throughout your site:

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

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

{% block stylesheets %}
<link href="{{ asset('css/main.css') }}" rel="stylesheet" />
{% endblock %}
</head>
<body>
{# ... #}
{# app/Resources/views/base.html.twig #}
<html>
<head>
{# ... #}

{% block javascripts %}
<script src="{{ asset('js/main.js') }}"></script>
{% endblock %}
</body>
</html>
{% block stylesheets %}
<link href="{{ asset('css/main.css') }}" rel="stylesheet" />
{% endblock %}
</head>
<body>
{# ... #}

{% block javascripts %}
<script src="{{ asset('js/main.js') }}"></script>
{% endblock %}
</body>
</html>

.. code-block:: php
// app/Resources/views/base.html.php
<html>
<head>
<?php ... ?>
<?php $view['slots']->start('stylesheets') ?>
<link href="<?php echo $view['assets']->getUrl('css/main.css') ?>" rel="stylesheet" />
<?php $view['slots']->stop() ?>
</head>
<body>
<?php ... ?>
<?php $view['slots']->start('javascripts') ?>
<script src="<?php echo $view['assets']->getUrl('js/main.js') ?>"></script>
<?php $view['slots']->stop() ?>
</body>
</html>
That's easy enough! But what if you need to include an extra stylesheet or
JavaScript from a child template? For example, suppose you have a contact
page and you need to include a ``contact.css`` stylesheet *just* on that
page. From inside that contact page's template, do the following:

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

.. code-block:: html+jinja

{# app/Resources/views/Contact/contact.html.twig #}
{% extends 'base.html.twig' %}

{% block stylesheets %}
{{ parent() }}

<link href="{{ asset('css/contact.css') }}" rel="stylesheet" />
{% endblock %}

{# app/Resources/views/Contact/contact.html.twig #}
{% extends 'base.html.twig' %}
{# ... #}

{% block stylesheets %}
{{ parent() }}
.. code-block:: php
<link href="{{ asset('css/contact.css') }}" rel="stylesheet" />
{% endblock %}
// app/Resources/views/Contact/contact.html.twig
<?php $view->extend('base.html.php') ?>
{# ... #}
<?php $view['slots']->start('stylesheets') ?>
<link href="<?php echo $view['assets']->getUrl('css/contact.css') ?>" rel="stylesheet" />
<?php $view['slots']->stop() ?>
In the child template, you simply override the ``stylesheets`` block and
put your new stylesheet tag inside of that block. Of course, since you want
Expand Down
4 changes: 2 additions & 2 deletions components/debug/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Installation

You can install the component in many different ways:

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

Usage
-----
Expand Down
43 changes: 0 additions & 43 deletions components/dependency_injection/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,49 +140,6 @@ rather than being tied up and hidden with the service definition:
If you were using this elsewhere as well, then you would only need to change
the parameter value in one place if needed.

You can also use the parameters in the service definition, for example,
making the class of a service a parameter:

.. configuration-block::

.. code-block:: yaml
parameters:
mailer.transport: sendmail
services:
mailer:
class: Mailer
arguments: ["%mailer.transport%"]
.. code-block:: xml
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="mailer.transport">sendmail</parameter>
</parameters>
<services>
<service id="mailer" class="Mailer">
<argument>%mailer.transport%</argument>
</service>
</services>
</container>
.. code-block:: php
use Symfony\Component\DependencyInjection\Reference;
$container->setParameter('mailer.transport', 'sendmail');
$container
->register('mailer', 'Mailer')
->addArgument('%mailer.transport%');
.. note::

The percent sign inside a parameter or argument, as part of the string, must
Expand Down
4 changes: 2 additions & 2 deletions components/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ of the ``Person`` class would be encoded in XML format::
</person>
EOF;

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

In this case, :method:`Symfony\\Component\\Serializer\\Serializer::deserialize`
needs three parameters:
Expand Down Expand Up @@ -326,7 +326,7 @@ having unique identifiers::

$serializer = new Serializer(array($normalizer), array($encoder));
echo $serializer->serialize($org, 'json');
// {"name":"Les-Tilleuls.coop","members":[{"name":"K\u00e9vin", organization: "Les-Tilleuls.coop"]}
// {"name":"Les-Tilleuls.coop","members":[{"name":"K\u00e9vin", organization: "Les-Tilleuls.coop"}]}

JMSSerializer
-------------
Expand Down
2 changes: 1 addition & 1 deletion components/templating/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ method is used.
$templating = new DelegatingEngine(array(
new PhpEngine(...),
new CustomEngine(...)
new CustomEngine(...),
));
.. _Packagist: https://packagist.org/packages/symfony/templating
2 changes: 1 addition & 1 deletion components/var_dumper/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ like this::
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;

VarDumper::setHandler(function($var) {
VarDumper::setHandler(function ($var) {
$cloner = new VarCloner();
$dumper = 'cli' === PHP_SAPI ? new CliDumper() : new HtmlDumper();

Expand Down
1 change: 1 addition & 0 deletions redirection_map
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/book/stable_api /contributing/code/bc
/cookbook/deployment-tools /cookbook/deployment/tools
/cookbook/doctrine/migrations /bundles/DoctrineFixturesBundle/index
/cookbook/doctrine/doctrine_fixtures /bundles/DoctrineFixturesBundle/index
Expand Down

0 comments on commit 81e8c13

Please sign in to comment.