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 3e93523

Browse filesBrowse files
committed
minor #10020 Removed more PHP template examples (javiereguiluz)
This PR was squashed before being merged into the 2.8 branch (closes #10020). Discussion ---------- Removed more PHP template examples In #10014 I forgot to apply the script to some files, so this PR fixes that. Commits ------- c02b5cc Removed more PHP template examples
2 parents 6d940aa + c02b5cc commit 3e93523
Copy full SHA for 3e93523

14 files changed

+248
-749
lines changed

‎controller.rst

Copy file name to clipboardExpand all lines: controller.rst
+13-35Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -417,47 +417,25 @@ you'll use this key to retrieve the message.
417417
In the template of the next page (or even better, in your base layout template),
418418
read any flash messages from the session:
419419

420-
.. configuration-block::
420+
.. code-block:: html+twig
421421

422-
.. code-block:: html+twig
422+
{# app/Resources/views/base.html.twig #}
423423

424-
{# app/Resources/views/base.html.twig #}
424+
{# you can read and display just one flash message type... #}
425+
{% for flash_message in app.session.flashBag.get('notice') %}
426+
<div class="flash-notice">
427+
{{ flash_message }}
428+
</div>
429+
{% endfor %}
425430

426-
{# you can read and display just one flash message type... #}
427-
{% for flash_message in app.session.flashBag.get('notice') %}
428-
<div class="flash-notice">
431+
{# ...or you can read and display every flash message available #}
432+
{% for type, flash_messages in app.session.flashBag.all %}
433+
{% for flash_message in flash_messages %}
434+
<div class="flash-{{ type }}">
429435
{{ flash_message }}
430436
</div>
431437
{% endfor %}
432-
433-
{# ...or you can read and display every flash message available #}
434-
{% for type, flash_messages in app.session.flashBag.all %}
435-
{% for flash_message in flash_messages %}
436-
<div class="flash-{{ type }}">
437-
{{ flash_message }}
438-
</div>
439-
{% endfor %}
440-
{% endfor %}
441-
442-
.. code-block:: html+php
443-
444-
<!-- app/Resources/views/base.html.php -->
445-
446-
// you can read and display just one flash message type...
447-
<?php foreach ($view['session']->getFlashBag()->get('notice') as $message): ?>
448-
<div class="flash-notice">
449-
<?php echo $message ?>
450-
</div>
451-
<?php endforeach ?>
452-
453-
// ...or you can read and display every flash message available
454-
<?php foreach ($view['session']->getFlashBag()->all() as $type => $flash_messages): ?>
455-
<?php foreach ($flash_messages as $flash_message): ?>
456-
<div class="flash-<?php echo $type ?>">
457-
<?php echo $message ?>
458-
</div>
459-
<?php endforeach ?>
460-
<?php endforeach ?>
438+
{% endfor %}
461439

462440
.. note::
463441

‎forms.rst

Copy file name to clipboardExpand all lines: forms.rst
+10-28Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -152,21 +152,12 @@ done by passing a special form "view" object to your template (notice the
152152
``$form->createView()`` in the controller above) and using a set of form
153153
helper functions:
154154

155-
.. configuration-block::
156-
157-
.. code-block:: html+twig
158-
159-
{# app/Resources/views/default/new.html.twig #}
160-
{{ form_start(form) }}
161-
{{ form_widget(form) }}
162-
{{ form_end(form) }}
163-
164-
.. code-block:: html+php
155+
.. code-block:: html+twig
165156

166-
<!-- app/Resources/views/default/new.html.php -->
167-
<?php echo $view['form']->start($form) ?>
168-
<?php echo $view['form']->widget($form) ?>
169-
<?php echo $view['form']->end($form) ?>
157+
{# app/Resources/views/default/new.html.twig #}
158+
{{ form_start(form) }}
159+
{{ form_widget(form) }}
160+
{{ form_end(form) }}
170161

171162
.. image:: /_images/form/simple-form.png
172163
:align: center
@@ -432,21 +423,12 @@ Validation is a very powerful feature of Symfony and has its own
432423
but are being prevented by your browser from, for example, submitting
433424
blank fields.
434425

435-
.. configuration-block::
436-
437-
.. code-block:: html+twig
438-
439-
{# app/Resources/views/default/new.html.twig #}
440-
{{ form_start(form, {'attr': {'novalidate': 'novalidate'}}) }}
441-
{{ form_widget(form) }}
442-
{{ form_end(form) }}
443-
444-
.. code-block:: html+php
426+
.. code-block:: html+twig
445427

446-
<!-- app/Resources/views/default/new.html.php -->
447-
<?php echo $view['form']->start($form, array('attr' => array('novalidate' => 'novalidate') ?>
448-
<?php echo $view['form']->widget($form) ?>
449-
<?php echo $view['form']->end($form) ?>
428+
{# app/Resources/views/default/new.html.twig #}
429+
{{ form_start(form, {'attr': {'novalidate': 'novalidate'}}) }}
430+
{{ form_widget(form) }}
431+
{{ form_end(form) }}
450432

451433
.. index::
452434
single: Forms; Built-in field types

‎frontend/assetic/apply_to_option.rst

Copy file name to clipboardExpand all lines: frontend/assetic/apply_to_option.rst
+18-55Lines changed: 18 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,11 @@ Filter a single File
6767
You can now serve up a single CoffeeScript file as JavaScript from within your
6868
templates:
6969

70-
.. configuration-block::
71-
72-
.. code-block:: html+twig
73-
74-
{% javascripts '@AppBundle/Resources/public/js/example.coffee' filter='coffee' %}
75-
<script src="{{ asset_url }}"></script>
76-
{% endjavascripts %}
70+
.. code-block:: html+twig
7771

78-
.. code-block:: html+php
79-
80-
<?php foreach ($view['assetic']->javascripts(
81-
array('@AppBundle/Resources/public/js/example.coffee'),
82-
array('coffee')
83-
) as $url): ?>
84-
<script src="<?php echo $view->escape($url) ?>"></script>
85-
<?php endforeach ?>
72+
{% javascripts '@AppBundle/Resources/public/js/example.coffee' filter='coffee' %}
73+
<script src="{{ asset_url }}"></script>
74+
{% endjavascripts %}
8675

8776
This is all that's needed to compile this CoffeeScript file and serve it
8877
as the compiled JavaScript.
@@ -92,27 +81,13 @@ Filter multiple Files
9281

9382
You can also combine multiple CoffeeScript files into a single output file:
9483

95-
.. configuration-block::
96-
97-
.. code-block:: html+twig
84+
.. code-block:: html+twig
9885

99-
{% javascripts '@AppBundle/Resources/public/js/example.coffee'
100-
'@AppBundle/Resources/public/js/another.coffee'
101-
filter='coffee' %}
102-
<script src="{{ asset_url }}"></script>
103-
{% endjavascripts %}
104-
105-
.. code-block:: html+php
106-
107-
<?php foreach ($view['assetic']->javascripts(
108-
array(
109-
'@AppBundle/Resources/public/js/example.coffee',
110-
'@AppBundle/Resources/public/js/another.coffee',
111-
),
112-
array('coffee')
113-
) as $url): ?>
114-
<script src="<?php echo $view->escape($url) ?>"></script>
115-
<?php endforeach ?>
86+
{% javascripts '@AppBundle/Resources/public/js/example.coffee'
87+
'@AppBundle/Resources/public/js/another.coffee'
88+
filter='coffee' %}
89+
<script src="{{ asset_url }}"></script>
90+
{% endjavascripts %}
11691

11792
Both files will now be served up as a single file compiled into regular JavaScript.
11893

@@ -188,24 +163,12 @@ template. You can also list regular JavaScript files, all of which will be
188163
combined and rendered as a single JavaScript file (with only the ``.coffee``
189164
files being run through the CoffeeScript filter):
190165

191-
.. configuration-block::
166+
.. code-block:: html+twig
167+
168+
{% javascripts '@AppBundle/Resources/public/js/example.coffee'
169+
'@AppBundle/Resources/public/js/another.coffee'
170+
'@AppBundle/Resources/public/js/regular.js' %}
171+
<script src="{{ asset_url }}"></script>
172+
{% endjavascripts %}
173+
192174

193-
.. code-block:: html+twig
194-
195-
{% javascripts '@AppBundle/Resources/public/js/example.coffee'
196-
'@AppBundle/Resources/public/js/another.coffee'
197-
'@AppBundle/Resources/public/js/regular.js' %}
198-
<script src="{{ asset_url }}"></script>
199-
{% endjavascripts %}
200-
201-
.. code-block:: html+php
202-
203-
<?php foreach ($view['assetic']->javascripts(
204-
array(
205-
'@AppBundle/Resources/public/js/example.coffee',
206-
'@AppBundle/Resources/public/js/another.coffee',
207-
'@AppBundle/Resources/public/js/regular.js',
208-
)
209-
) as $url): ?>
210-
<script src="<?php echo $view->escape($url) ?>"></script>
211-
<?php endforeach ?>

0 commit comments

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