Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
layout_update.php
Go to the documentation of this file.
1 <?php
9 $objectManager->get(\Magento\Framework\App\AreaList::class)
10  ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE)
11  ->load(\Magento\Framework\App\Area::PART_CONFIG);
13 $theme = $objectManager->create(\Magento\Framework\View\Design\ThemeInterface::class);
14 $theme->setThemePath(
15  'test/test'
16 )->setArea(
17  'frontend'
18 )->setThemeTitle(
19  'Test Theme'
20 )->setType(
21  \Magento\Framework\View\Design\ThemeInterface::TYPE_VIRTUAL
22 )->save();
23 
25 $updateNotTemporary = $objectManager->create(\Magento\Widget\Model\Layout\Update::class);
26 $updateNotTemporary->setHandle(
27  'test_handle'
28 )->setXml(
29  'not_temporary'
30 )->setStoreId(
31  0
32 )->setThemeId(
33  $theme->getId()
34 )->save();
35 
37 $updateTemporary = $objectManager->create(\Magento\Widget\Model\Layout\Update::class);
38 $updateTemporary->setHandle(
39  'test_handle'
40 )->setIsTemporary(
41  1
42 )->setXml(
43  'temporary'
44 )->setStoreId(
45  0
46 )->setThemeId(
47  $theme->getId()
48 )->save();
$updateTemporary
$theme
$objectManager
$updateNotTemporary