8000 Use native Twig references for templates · FriendsOfSymfony/FOSUserBundle@dd1fa8f · GitHub
[go: up one dir, main page]

Skip to content

Commit dd1fa8f

Browse files
committed
Use native Twig references for templates
This makes the template compatible with projects disabling the Templating component in recent Symfony versions.
1 parent c0ba632 commit dd1fa8f

27 files changed

+52
-52
lines changed

Controller/ChangePasswordController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function changePasswordAction(Request $request)
8484
return $response;
8585
}
8686

87-
return $this->render('FOSUserBundle:ChangePassword:change_password.html.twig', array(
87+
return $this->render('@FOSUser/ChangePassword/change_password.html.twig', array(
8888
'form' => $form->createView(),
8989
));
9090
}

Controller/GroupController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function listAction()
4040
{
4141
$groups = $this->get('fos_user.group_manager')->findGroups();
4242

43-
return $this->render('FOSUserBundle:Group:list.html.twig', array(
43+
return $this->render('@FOSUser/Group/list.html.twig', array(
4444
'groups' => $groups,
4545
));
4646
}
@@ -56,7 +56,7 @@ public function showAction($groupName)
5656
{
575 F438 7
$group = $this->findGroupBy('name', $groupName);
5858

59-
return $this->render('FOSUserBundle:Group:show.html.twig', array(
59+
return $this->render('@FOSUser/Group/show.html.twig', array(
6060
'group' => $group,
6161
));
6262
}
@@ -110,7 +110,7 @@ public function editAction(Request $request, $groupName)
110110
return $response;
111111
}
112112

113-
return $this->render('FOSUserBundle:Group:edit.html.twig', array(
113+
return $this->render('@FOSUser/Group/edit.html.twig', array(
114114
'form' => $form->createView(),
115115
'group_name' => $group->getName(),
116116
));
@@ -157,7 +157,7 @@ public function newAction(Request $request)
157157
return $response;
158158
}
159159

160-
return $this->render('FOSUserBundle:Group:new.html.twig', array(
160+
return $this->render('@FOSUser/Group/new.html.twig', array(
161161
'form' => $form->createView(),
162162
));
163163
}

Controller/ProfileController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function showAction()
4242
throw new AccessDeniedException('This user does not have access to this section.');
4343
}
4444

45-
return $this->render('FOSUserBundle:Profile:show.html.twig', array(
45+
return $this->render('@FOSUser/Profile/show.html.twig', array(
4646
'user' => $user,
4747
));
4848
}
@@ -98,7 +98,7 @@ public function editAction(Request $request)
9898
return $response;
9999
}
100100

101-
return $this->render('FOSUserBundle:Profile:edit.html.twig', array(
101+
return $this->render('@FOSUser/Profile/edit.html.twig', array(
102102
'form' => $form->createView(),
103103
));
104104
}

Controller/RegistrationController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function registerAction(Request $request)
8888
}
8989
}
9090

91-
return $this->render('FOSUserBundle:Registration:register.html.twig', array(
91+
return $this->render('@FOSUser/Registration/register.html.twig', array(
9292
'form' => $form->createView(),
9393
));
9494
}
@@ -111,7 +111,7 @@ public function checkEmailAction()
111111
throw new NotFoundHttpException(sprintf('The user with email "%s" does not exist', $email));
112112
}
113113

114-
return $this->render('FOSUserBundle:Registration:check_email.html.twig', array(
114+
return $this->render('@FOSUser/Registration/check_email.html.twig', array(
115115
'user' => $user,
116116
));
117117
}
@@ -166,7 +166,7 @@ public function confirmedAction()
166166
throw new AccessDeniedException('This user does not have access to this section.');
167167
}
168168

169-
return $this->render('FOSUserBundle:Registration:confirmed.html.twig', array(
169+
return $this->render('@FOSUser/Registration/confirmed.html.twig', array(
170170
'user' => $user,
171171
'targetUrl' => $this->getTargetUrlFromSession(),
172172
));

Controller/ResettingController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ResettingController extends Controller
3838
*/
3939
public function requestAction()
4040
{
41-
return $this->render('FOSUserBundle:Resetting:request.html.twig');
41+
return $this->render('@FOSUser/Resetting/request.html.twig');
4242
}
4343

4444
/**
@@ -121,7 +121,7 @@ public function checkEmailAction(Request $request)
121121
return new RedirectResponse($this->generateUrl('fos_user_resetting_request'));
122122
}
123123

124-
return $this->render('FOSUserBundle:Resetting:check_email.html.twig', array(
124+
return $this->render('@FOSUser/Resetting/check_email.html.twig', array(
125125
'tokenLifetime' => ceil($this->container->getParameter('fos_user.resetting.token_ttl') / 3600),
126126
));
127127
}
@@ -180,7 +180,7 @@ public function resetAction(Request $request, $token)
180180
return $response;
181181
}
182182

183-
return $this->render('FOSUserBundle:Resetting:reset.html.twig', array(
183+
return $this->render('@FOSUser/Resetting/reset.html.twig', array(
184184
'token' => $token,
185185
'form' => $form->createView(),
186186
));

Controller/SecurityController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function loginAction(Request $request)
7070
*/
7171
protected function renderLogin(array $data)
7272
{
73-
return $this->render('FOSUserBundle:Security:login.html.twig', $data);
73+
return $this->render('@FOSUser/Security/login.html.twig', $data);
7474
}
7575

7676
public function checkAction()

DependencyInjection/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private function addRegistrationSection(ArrayNodeDefinition $node)
< F438 /td>
128128
->addDefaultsIfNotSet()
129129
->children()
130130
->booleanNode('enabled')->defaultFalse()->end()
131-
->scalarNode('template')->defaultValue('FOSUserBundle:Registration:email.txt.twig')->end()
131+
->scalarNode('template')->defaultValue('@FOSUser/Registration/email.txt.twig')->end()
132132
->arrayNode('from_email')
133133
->canBeUnset()
134134
->children()
@@ -169,7 +169,7 @@ private function addResettingSection(ArrayNodeDefinition $node)
169169
->arrayNode('email')
170170
->addDefaultsIfNotSet()
171171
->children()
172-
->scalarNode('template')->defaultValue('FOSUserBundle:Resetting:email.txt.twig')->end()
172+
->scalarNode('template')->defaultValue('@FOSUser/Resetting/email.txt.twig')->end()
173173
->arrayNode('from_email')
174174
->canBeUnset()
175175
->children()

Resources/config/mailer.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
66

77
<parameters>
8-
<parameter key="fos_user.resetting.email.template">FOSUserBundle:Resetting:email.txt.twig</parameter>
9-
<parameter key="fos_user.registration.confirmation.template">FOSUserBundle:Registration:email.txt.twig</parameter>
8+
<parameter key="fos_user.resetting.email.template">@FOSUser/Resetting/email.txt.twig</parameter>
9+
<parameter key="fos_user.registration.confirmation.template">@FOSUser/Registration/email.txt.twig</parameter>
1010
</parameters>
1111

1212
<services>

Resources/doc/configuration_reference.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ All available configuration options are listed below with their default values.
3232
address: ...
3333
sender_name: ...
3434
enabled: false # change to true for required email confirmation
35-
template: FOSUserBundle:Registration:email.txt.twig
35+
template: '@FOSUser/Registration/email.txt.twig'
3636
form:
3737
type: FOS\UserBundle\Form\Type\RegistrationFormType # or 'fos_user_registration' on Symfony < 2.8
3838
name: fos_user_registration_form
@@ -43,7 +43,7 @@ All available configuration options are listed below with their default values.
4343
from_email: # Use this node only if you don't want the global email address for the resetting email
4444
address: ...
4545
sender_name: ...
46-
template: FOSUserBundle:Resetting:email.txt.twig
46+
template: '@FOSUser/Resetting/email.txt.twig'
4747
form:
4848
type: FOS\UserBundle\Form\Type\ResettingFormType # or 'fos_user_resetting' on Symfony < 2.8
4949
name: fos_user_resetting_form

Resources/doc/emails.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ of referencing the email template below.
129129
template: email/password_resetting.email.twig
130130
registration:
131131
confirmation:
132-
template: FOSUserBundle:Registration:email.txt.twig
132+
template: '@FOSUser/Registration/email.txt.twig'
133133
134134
.. code-block:: html+jinja
135135

@@ -163,8 +163,8 @@ of referencing the email template below.
163163
not empty.
164164

165165
You can view the default email templates at
166-
`FOSUserBundle:Registration:email.txt.twig` and
167-
`FOSUserBundle:Resetting:email.txt.twig`
166+
`@FOSUser/Registration/email.txt.twig` and
167+
`@FOSUser/Resetting/email.txt.twig`
168168

169169
Using A Custom Mailer
170170
---------------------

Resources/doc/overriding_controllers.rst

Copy file name to clipboard
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ the base controller and adds logging a new user registration to it.
9595
return new RedirectResponse($url);
9696
}
9797
98-
return $this->container->get('templating')->renderResponse('FOSUserBundle:Registration:register.html.twig', array(
98+
return $this->container->get('templating')->renderResponse('@FOSUser/Registration/register.html.twig', array(
9999
'form' => $form->createView(),
100100
));
101101
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% block fos_user_content %}
4-
{% include "FOSUserBundle:ChangePassword:change_password_content.html.twig" %}
4+
{% include "@FOSUser/ChangePassword/change_password_content.html.twig" %}
55
{% endblock fos_user_content %}

Resources/views/Group/edit.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% block fos_user_content %}
4-
{% include "FOSUserBundle:Group:edit_content.html.twig" %}
4+
{% include "@FOSUser/Group/edit_content.html.twig" %}
55
{% endblock fos_user_content %}

Resources/views/Group/list.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% block fos_user_content %}
4-
{% include "FOSUserBundle:Group:list_content.html.twig" %}
4+
{% include "@FOSUser/Group/list_content.html.twig" %}
55
{% endblock fos_user_content %}

Resources/views/Group/new.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% block fos_user_content %}
4-
{% include "FOSUserBundle:Group:new_content.html.twig" %}
4+
{% include "@FOSUser/Group/new_content.html.twig" %}
55
{% endblock fos_user_content %}

Resources/views/Group/show.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% block fos_user_content %}
4-
{% include "FOSUserBundle:Group:show_content.html.twig" %}
4+
{% include "@FOSUser/Group/show_content.html.twig" %}
55
{% endblock fos_user_content %}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% block fos_user_content %}
4-
{% include "FOSUserBundle:Profile:edit_content.html.twig" %}
4+
{% include "@FOSUser/Profile/edit_content.html.twig" %}
55
{% endblock fos_user_content %}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% block fos_user_content %}
4-
{% include "FOSUserBundle:Profile:show_content.html.twig" %}
4+
{% include "@FOSUser/Profile/show_content.html.twig" %}
55
{% endblock fos_user_content %}

Resources/views/Registration/check_email.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% trans_default_domain 'FOSUserBundle' %}
44

Resources/views/Registration/confirmed.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% trans_default_domain 'FOSUserBundle' %}
44

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% block fos_user_content %}
4-
{% include "FOSUserBundle:Registration:register_content.html.twig" %}
4+
{% include "register_content.html.twig" %}
55
{% endblock fos_user_content %}

Resources/views/Resetting/check_email.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% trans_default_domain 'FOSUserBundle' %}
44

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% block fos_user_content %}
4-
{% include "FOSUserBundle:Resetting:request_content.html.twig" %}
4+
{% include "@FOSUser/Resetting/request_content.html.twig" %}
55
{% endblock fos_user_content %}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% block fos_user_content %}
4-
{% include "FOSUserBundle:Resetting:reset_content.html.twig" %}
4+
{% include "@FOSUser/Resetting/reset_content.html.twig" %}
55
{% endblock fos_user_content %}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% extends "FOSUserBundle::layout.html.twig" %}
1+
{% extends "@FOSUser/layout.html.twig" %}
22

33
{% block fos_user_content %}
4-
{{ include('FOSUserBundle:Security:login_content.html.twig') }}
4+
{{ include('@FOSUser/Security/login_content.html.twig') }}
55
{% endblock fos_user_content %}

Tests/DependencyInjection/FOSUserExtensionTest.php

Lines changed: 2 additions & 2 deletions
8C3B
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ public function testUserLoadConfirmationEmailWithDefaults()
245245

246246
$this->assertParameter(false, 'fos_user.registration.confirmation.enabled');
247247
$this->assertParameter(array('webmaster@example.com' => 'webmaster'), 'fos_user.registration.confirmation.from_email');
248-
$this->assertParameter('FOSUserBundle:Registration:email.txt.twig', 'fos_user.registration.confirmation.template');
249-
$this->assertParameter('FOSUserBundle:Resetting:email.txt.twig', 'fos_user.resetting.email.template');
248+
$this->assertParameter('@FOSUser/Registration/email.txt.twig', 'fos_user.registration.confirmation.template');
249+
$this->assertParameter('@FOSUser/Resetting/email.txt.twig', 'fos_user.resetting.email.template');
250250
$this->assertParameter(array('webmaster@example.com' => 'webmaster'), 'fos_user.resetting.email.from_email');
251251
$this->assertParameter(86400, 'fos_user.resetting.token_ttl');
252252
}

Upgrade.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ After:
9292
```php
9393
public function checkEmailAction()
9494
{
95-
return $this->render('FOSUserBundle:Registration:check_email.html.twig');
95+
return $this->render('@FOSUserBundle/Registration/check_email.html.twig');
9696
}
9797
```
9898

0 commit comments

Comments
 (0)
0