File tree Expand file tree Collapse file tree 5 files changed +15
-43
lines changed
Backend/view/adminhtml/templates/page/js
Test/Unit/Block/Html/Head Expand file tree Collapse file tree 5 files changed +15
-43
lines changed Original file line number Diff line number Diff line change 7
7
<script>
8
8
var BASE_URL = '<?php /* @escapeNotVerified */ echo $ block ->getUrl ('* ' ) ?> ';
9
9
var FORM_KEY = '<?php /* @escapeNotVerified */ echo $ block ->getFormKey () ?> ';
10
+ var require = {
11
+ "baseUrl": "<?php /* @escapeNotVerified */ echo $ block ->getViewFileUrl ('/ ' ) ?> "
12
+ };
10
13
</script>
Original file line number Diff line number Diff line change @@ -119,16 +119,4 @@ protected function _prepareLayout()
119
119
120
120
return parent ::_prepareLayout ();
121
121
}
122
-
123
- /**
124
- * Include base RequireJs configuration necessary for working with Magento application
125
- *
126
- * @return string|void
127
- */
128
- protected function _toHtml ()
129
- {
130
- return "<script type= \"text/javascript \"> \n"
131
- . $ this ->config ->getBaseConfig ()
132
- . "</script> \n" ;
133
- }
134
122
}
Original file line number Diff line number Diff line change @@ -131,35 +131,4 @@ public function testSetLayout()
131
131
);
132
132
$ object ->setLayout ($ layout );
133
133
}
134
-
135
- public function testToHtml ()
136
- {
137
- $ this ->context ->expects ($ this ->once ())
138
- ->method ('getEventManager ' )
139
- ->will ($ this ->returnValue ($ this ->getMockForAbstractClass ('\Magento\Framework\Event\ManagerInterface ' )));
140
- $ this ->context ->expects ($ this ->once ())
141
- ->method ('getScopeConfig ' )
142
- ->will ($ this ->returnValue (
143
- $ this ->getMockForAbstractClass ('\Magento\Framework\App\Config\ScopeConfigInterface ' )
144
- ));
145
- $ this ->config ->expects ($ this ->once ())->method ('getBaseConfig ' )->will ($ this ->returnValue ('the config data ' ));
146
- $ this ->minificationMock = $ this ->getMockBuilder ('Magento\Framework\View\Asset\Minification ' )
147
- ->disableOriginalConstructor ()
148
- ->getMock ();
149
-
150
- $ object = new Config (
151
- $ this ->context ,
152
- $ this ->config ,
153
- $ this ->fileManager ,
154
- $ this ->pageConfig ,
155
- $ this ->bundleConfig ,
156
- $ this ->minificationMock
157
- );
158
- $ html = $ object ->toHtml ();
159
- $ expectedFormat = <<<expected
160
- <script type="text/javascript">
161
- the config data</script>
162
- expected ;
163
- $ this ->assertStringMatchesFormat ($ expectedFormat , $ html );
164
- }
165
134
}
Original file line number Diff line number Diff line change 8
8
<page layout =" 3columns" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:View/Layout/etc/page_configuration.xsd" >
9
9
<update handle =" default_head_blocks" />
10
10
<body >
11
+ <block name =" require.js" class =" Magento\Framework\View\Element\Template" template =" Magento_Theme::page/js/require_js.phtml" />
11
12
<referenceContainer name =" after.body.start" >
12
13
<block class =" Magento\RequireJs\Block\Html\Head\Config" name =" requirejs-config" />
13
14
<block class =" Magento\Translation\Block\Html\Head\Config" name =" translate-config" />
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2015 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ ?>
7
+ <script>
8
+ var require = {
9
+ "baseUrl": "<?php /* @escapeNotVerified */ echo $ block ->getViewFileUrl ('/ ' ) ?> "
10
+ };
11
+ </script>
You can’t perform that action at this time.
0 commit comments