Skip to content

Commit

Permalink
minor symfony#8138 follow best practices for template files (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.7 branch.

Discussion
----------

follow best practices for template files

Commits
-------

f0b71f8 follow best practices for template files
  • Loading branch information
xabbuh committed Jul 11, 2017
2 parents 517f386 + f0b71f8 commit 31a0a09
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions controller/service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Symfony's base controller::
public function indexAction($name)
{
return $this->render(
'@App/Hello/index.html.twig',
'hello/index.html.twig',
array('name' => $name)
);
}
Expand Down Expand Up @@ -213,7 +213,7 @@ service and use it directly::
public function indexAction($name)
{
return $this->templating->renderResponse(
'@App/Hello/index.html.twig',
'hello/index.html.twig',
array('name' => $name)
);
}
Expand Down
6 changes: 3 additions & 3 deletions form/direct_submit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ submissions::
return $this->redirectToRoute('task_success');
}

return $this->render('@App/Default/new.html.twig', array(
return $this->render('default/new.html.twig', array(
'form' => $form->createView(),
));
}
Expand Down Expand Up @@ -67,7 +67,7 @@ method, pass the submitted data directly to
}
}

return $this->render('@App/Default/new.html.twig', array(
return $this->render('default/new.html.twig', array(
'form' => $form->createView(),
));
}
Expand Down Expand Up @@ -126,7 +126,7 @@ a convenient shortcut to the previous example::
}
}

return $this->render('@App/Default/new.html.twig', array(
return $this->render('default/new.html.twig', array(
'form' => $form->createView(),
));
}
Expand Down
4 changes: 2 additions & 2 deletions form/dynamic_form_modification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ your application. Assume that you have a sport meetup creation controller::
}

return $this->render(
'@App/Meetup/create.html.twig',
'meetup/create.html.twig',
array('form' => $form->createView())
);
}
Expand All @@ -631,7 +631,7 @@ field according to the current selection in the ``sport`` field:

.. code-block:: html+twig

{# app/Resources/views/Meetup/create.html.twig #}
{# app/Resources/views/meetup/create.html.twig #}
{{ form_start(form) }}
{{ form_row(form.sport) }} {# <select id="meetup_sport" ... #}
{{ form_row(form.position) }} {# <select id="meetup_position" ... #}
Expand Down
4 changes: 2 additions & 2 deletions form/form_collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ In your controller, you'll now initialize a new instance of ``TaskType``::
// ... maybe do some form processing, like saving the Task and Tag objects
}

return $this->render('@App/Task/new.html.twig', array(
return $this->render('task/new.html.twig', array(
'form' => $form->createView(),
));
}
Expand All @@ -200,7 +200,7 @@ zero tags when first created).

.. code-block:: html+twig

{# src/AppBundle/Resources/views/Task/new.html.twig #}
{# app/Resources/views/task/new.html.twig #}

{# ... #}

Expand Down
2 changes: 1 addition & 1 deletion profiler/data_collector.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ block and set the value of two variables called ``icon`` and ``text``:

.. code-block:: twig
{{ include('@App/data_collector/icon.svg') }}
{{ include('data_collector/icon.svg') }}
You are encouraged to use the latter technique for your own toolbar panels.

Expand Down
6 changes: 3 additions & 3 deletions reference/configuration/twig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ TwigBundle Configuration ("twig")
- bootstrap_3_horizontal_layout.html.twig
# Example:
- @App/form.html.twig
- form.html.twig
globals:
Expand Down Expand Up @@ -75,7 +75,7 @@ TwigBundle Configuration ("twig")
optimizations="true"
>
<twig:form-theme>form_div_layout.html.twig</twig:form-theme> <!-- Default -->
<twig:form-theme>@App/form.html.twig</twig:form-theme>
<twig:form-theme>form.html.twig</twig:form-theme>
<twig:global key="foo" id="bar" type="service" />
<twig:global key="pi">3.14</twig:global>
Expand All @@ -91,7 +91,7 @@ TwigBundle Configuration ("twig")
$container->loadFromExtension('twig', array(
'form_themes' => array(
'form_div_layout.html.twig', // Default
'@App/form.html.twig',
'form.html.twig',
),
'globals' => array(
'foo' => '@bar',
Expand Down

0 comments on commit 31a0a09

Please sign in to comment.