Skip to content

Commit 953ed9c

Browse files
committed
MAGETWO-99482: Use escaper methods
- refactored $this->helper out of templates
1 parent f42d71f commit 953ed9c

File tree

5 files changed

+50
-13
lines changed

5 files changed

+50
-13
lines changed

app/code/Magento/Integration/view/adminhtml/templates/resourcetree.phtml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107

118
<?php
@@ -44,7 +41,7 @@
4441

4542
<div class="control">
4643
<div class="tree x-tree" data-role="resource-tree" data-mage-init='<?=
47-
$block->escapeHtml($this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode([
44+
$block->escapeHtml($block->toJson([
4845
'rolesTree' => [
4946
"treeInitData" => $block->getTree(),
5047
"treeInitSelectedData" => $block->getSelectedResources(),
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\User\ViewModel;
8+
9+
use Magento\Backend\Model\UrlInterface;
10+
11+
/**
12+
* Provides Forgot Password Url
13+
*/
14+
class ForgotPasswordUrlProvider implements \Magento\Framework\View\Element\Block\ArgumentInterface
15+
{
16+
17+
/**
18+
* @var \Magento\Backend\Model\UrlInterface
19+
*/
20+
private $backendUrl;
21+
22+
/**
23+
* @param UrlInterface $backendUrl
24+
*/
25+
public function __construct(UrlInterface $backendUrl)
26+
{
27+
$this->backendUrl = $backendUrl;
28+
}
29+
30+
/**
31+
* @param string $route
32+
* @param array $params
33+
* @return string
34+
*/
35+
public function getUrl($route = '', $params = [])
36+
{
37+
return $this->backendUrl->getUrl($route, $params);
38+
}
39+
}

app/code/Magento/User/view/adminhtml/layout/adminhtml_auth_login.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<body>
1010
<referenceContainer name="form.buttons">
11-
<block class="Magento\Backend\Block\Template" name="adminhtml_auth_login_forgotpassword" template="Magento_User::admin/forgotpassword_url.phtml"/>
11+
<block class="Magento\Backend\Block\Template" name="adminhtml_auth_login_forgotpassword" template="Magento_User::admin/forgotpassword_url.phtml">
12+
<arguments>
13+
<argument name="view_model" xsi:type="object">Magento\User\ViewModel\ForgotPasswordUrlProvider</argument>
14+
</arguments>
15+
</block>
1216
</referenceContainer>
1317
</body>
1418
</page>

app/code/Magento/User/view/adminhtml/templates/admin/forgotpassword_url.phtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<div class="links">
11-
<a class="action-forgotpassword" href="<?= $block->escapeUrl($this->helper(\Magento\Backend\Helper\Data::class)->getUrl('adminhtml/auth/forgotpassword', ['_nosecret' => true])) ?>"><?= $block->escapeHtml(__('Forgot your password?')) ?></a>
8+
<a class="action-forgotpassword" href="<?= $block->escapeUrl(
9+
$block->getViewModel()->getUrl('adminhtml/auth/forgotpassword', ['_nosecret' => true])
10+
) ?>"><?= $block->escapeHtml(__('Forgot your password?')) ?>
11+
</a>
1212
</div>

app/code/Magento/User/view/adminhtml/templates/role/edit.phtml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107

118
<?php
@@ -45,7 +42,7 @@
4542
<div class="control">
4643
<div class="tree x-tree" data-role="resource-tree"
4744
data-mage-init='<?= $block->escapeHtml(
48-
$this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode(
45+
$block->toJson(
4946
[
5047
'rolesTree' => [
5148
"treeInitData" => $block->getTree(),

0 commit comments

Comments
 (0)