Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-theme
Model
Theme
Domain
Virtual.php
Go to the documentation of this file.
1
<?php
10
namespace
Magento\Theme\Model\Theme\Domain
;
11
12
class
Virtual
implements
\Magento\Framework\View\Design\Theme\Domain\VirtualInterface
13
{
19
protected
$_theme
;
20
24
protected
$_themeFactory
;
25
31
protected
$_stagingTheme
;
32
36
protected
$_themeCopyService
;
37
43
protected
$_customizationConfig
;
44
51
public
function
__construct
(
52
\
Magento
\Framework\View\
Design
\
ThemeInterface
$theme
,
53
\
Magento
\
Theme
\Model\ThemeFactory $themeFactory,
54
\
Magento
\
Theme
\Model\
CopyService
$themeCopyService,
55
\
Magento
\
Theme
\Model\
Config
\Customization $customizationConfig
56
) {
57
$this->_theme =
$theme
;
58
$this->_themeFactory = $themeFactory;
59
$this->_themeCopyService = $themeCopyService;
60
$this->_customizationConfig = $customizationConfig;
61
}
62
68
public
function
getStagingTheme
()
69
{
70
if
(!$this->_stagingTheme) {
71
$this->_stagingTheme = $this->_theme->getStagingVersion();
72
if
(!$this->_stagingTheme) {
73
$this->_stagingTheme = $this->
_createStagingTheme
();
74
$this->_themeCopyService->copy($this->_theme, $this->_stagingTheme);
75
}
76
}
77
return
$this->_stagingTheme
;
78
}
79
85
public
function
getPhysicalTheme
()
86
{
88
$parentTheme = $this->_theme->getParentTheme();
89
while
($parentTheme && !$parentTheme->isPhysical()) {
90
$parentTheme = $parentTheme->getParentTheme();
91
}
92
93
if
(!$parentTheme || !$parentTheme->getId()) {
94
return
null
;
95
}
96
97
return
$parentTheme;
98
}
99
105
public
function
isAssigned
()
106
{
107
return
$this->_customizationConfig->isThemeAssignedToStore($this->_theme);
108
}
109
115
protected
function
_createStagingTheme
()
116
{
117
$stagingTheme = $this->_themeFactory->create();
118
$stagingTheme->setData(
119
[
120
'parent_id'
=> $this->_theme->getId(),
121
'theme_path'
=>
null
,
122
'theme_title'
=> sprintf(
'%s - Staging'
, $this->_theme->getThemeTitle()),
123
'preview_image'
=> $this->_theme->getPreviewImage(),
124
'is_featured'
=> $this->_theme->getIsFeatured(),
125
'type'
=>
\Magento\Framework\View\Design\ThemeInterface::TYPE_STAGING
,
126
]
127
);
128
$stagingTheme->save();
129
return
$stagingTheme;
130
}
131
}
Magento\Theme\Model\Theme\Domain
Definition:
VirtualTest.php:6
Magento\Theme\Model\Theme
Definition:
Theme.php:36
Magento\Theme\Model\Design
Definition:
Design.php:27
Magento\Theme\Model\Theme\Domain\Virtual\$_stagingTheme
$_stagingTheme
Definition:
Virtual.php:31
Magento\Theme\Model\Theme\Domain\Virtual\$_themeCopyService
$_themeCopyService
Definition:
Virtual.php:36
Magento\Theme\Model\Theme\Domain\Virtual\__construct
__construct(\Magento\Framework\View\Design\ThemeInterface $theme, \Magento\Theme\Model\ThemeFactory $themeFactory, \Magento\Theme\Model\CopyService $themeCopyService, \Magento\Theme\Model\Config\Customization $customizationConfig)
Definition:
Virtual.php:51
Magento\Theme\Model\Theme\Domain\Virtual\$_theme
$_theme
Definition:
Virtual.php:19
Magento\Theme\Model\Theme\Domain\Virtual\$_themeFactory
$_themeFactory
Definition:
Virtual.php:24
Magento\Framework\DataObject\Copy
Magento\Framework\View\Design\ThemeInterface
Definition:
ThemeInterface.php:14
Magento\Framework\View\Design\ThemeInterface\TYPE_STAGING
const TYPE_STAGING
Definition:
ThemeInterface.php:39
Magento\Theme\Model\Theme\Domain\Virtual\isAssigned
isAssigned()
Definition:
Virtual.php:105
Magento\Theme\Model\Theme\Domain\Virtual\_createStagingTheme
_createStagingTheme()
Definition:
Virtual.php:115
Magento\Theme\Model\Theme\Domain\Virtual
Definition:
Virtual.php:12
Magento\Framework\View\Design\Theme\Domain\VirtualInterface\getPhysicalTheme
getPhysicalTheme()
Magento\Theme\Model\Theme\Domain\Virtual\getStagingTheme
getStagingTheme()
Definition:
Virtual.php:68
Magento
$theme
$theme
Definition:
theme_rollback.php:9
Magento\Theme\Model\Config
Definition:
Config.php:14
Magento\Theme\Model\Theme\Domain\Virtual\$_customizationConfig
$_customizationConfig
Definition:
Virtual.php:43
Magento\Framework\View\Design\Theme\Domain\VirtualInterface
Definition:
VirtualInterface.php:11