-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathappLayoutPage.php
57 lines (47 loc) · 1.92 KB
/
appLayoutPage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
// Update layout in new version magento 2.3.4 or last
ini_set('display_startup_errors', 1);ini_set('display_errors', 1); error_reporting(-1);
use Magento\Theme\Model\Theme\Collection;
use Magento\Framework\App\Area;
require dirname(__FILE__) . '/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
class Outslide extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
$pageId = 19; // Id of page
$model = $this->_objectManager->create('Magento\Cms\Model\Page');
$model->load($pageId); // Id of page
$pageData = [
// 'title' => "title page",
// 'page_layout' => "page_layout type",
// 'identifier' => "identifier",
// 'content_heading' => "content_heading text",
// 'content' => "Content Text",
'layout_update_xml' => '<!-- Slide showcase-->
<referenceContainer name="slide.showcase">
<block class="Magento\Cms\Block\Block" name="slide">
<arguments>
<argument name="block_id" xsi:type="string">static-home-slide</argument>
</arguments>
</block>
</referenceContainer>
<!-- alo sectionsbottom-->
<referenceContainer name="alo.sectionsbottom">
<block class="Magento\Cms\Block\Block" name="static_sections_bottom">
<arguments>
<argument name="block_id" xsi:type="string">static_sections_bottom</argument>
</arguments>
</block>
</referenceContainer>',
'is_active' => 1
];
$model->addData( $pageData )->save();
echo 'Done update layout page';
//the method must end with this line
return $this->_response;
}
}
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Outslide');
$bootstrap->run($app);