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
framework
View
TemplateEngine
Xhtml
TemplateFactory.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Framework\View\TemplateEngine\Xhtml
;
8
9
use
Magento\Framework\Phrase
;
10
use
Magento\Framework\ObjectManagerInterface
;
11
use
Magento\Framework\Exception\LocalizedException
;
12
16
class
TemplateFactory
17
{
23
protected
$objectManager
;
24
30
protected
$instanceName
;
31
38
public
function
__construct
(
39
ObjectManagerInterface
$objectManager
,
40
$instanceName
= \
Magento
\Framework\View\TemplateEngine\
Xhtml
\Template::class
41
) {
42
$this->objectManager =
$objectManager
;
43
$this->instanceName =
$instanceName
;
44
}
45
53
public
function
create
(array
$arguments
= [])
54
{
55
$object = $this->objectManager->create($this->instanceName,
$arguments
);
56
57
if
(!($object instanceof
Template
)) {
58
throw
new
LocalizedException
(
59
new
Phrase
(
'This class needs to inherit from a class "Template". Verify the class and try again.'
)
60
);
61
}
62
63
return
$object;
64
}
65
}
Magento\Framework\Exception\LocalizedException
Definition:
LocalizedException.php:17
Magento\Framework\View\TemplateEngine\Xhtml\TemplateFactory
Definition:
TemplateFactory.php:16
Magento\Framework\ObjectManagerInterface
Definition:
ObjectManagerInterface.php:12
Magento\Framework\View\TemplateEngine\Xhtml\TemplateFactory\__construct
__construct(ObjectManagerInterface $objectManager, $instanceName=\Magento\Framework\View\TemplateEngine\Xhtml\Template::class)
Definition:
TemplateFactory.php:38
Magento\Framework\View\TemplateEngine\Xhtml\TemplateFactory\$instanceName
$instanceName
Definition:
TemplateFactory.php:30
Magento\Framework\View\TemplateEngine\Xhtml\TemplateFactory\create
create(array $arguments=[])
Definition:
TemplateFactory.php:53
Magento
Magento\Framework\View\TemplateEngine\Xhtml
$arguments
$arguments
Definition:
final_price.phtml:24
Magento\Framework\View\TemplateEngine\Xhtml
Definition:
Xhtml.php:20
Magento\Framework\View\TemplateEngine\Xhtml\TemplateFactory\$objectManager
$objectManager
Definition:
TemplateFactory.php:23
Magento\Framework\Phrase
Definition:
Phrase.php:17
Magento\Framework\Phrase
Magento\Framework\View\TemplateEngine\Xhtml\Template
Definition:
Template.php:11