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
Element
BlockFactory.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\View\Element
;
7
8
use
Magento\Framework\ObjectManagerInterface
;
9
16
class
BlockFactory
17
{
23
protected
$objectManager
;
24
30
public
function
__construct
(
ObjectManagerInterface
$objectManager
)
31
{
32
$this->objectManager =
$objectManager
;
33
}
34
43
public
function
createBlock
($blockName, array
$arguments
= [])
44
{
45
$blockName = ltrim($blockName,
'\\'
);
46
$block
= $this->objectManager->create($blockName,
$arguments
);
47
if
(!
$block
instanceof
BlockInterface
) {
48
throw
new \LogicException($blockName .
' does not implement BlockInterface'
);
49
}
50
if
(
$block
instanceof
Template
) {
51
$block
->setTemplateContext(
$block
);
52
}
53
return
$block
;
54
}
55
}
Magento\Framework\View\Element\BlockFactory\__construct
__construct(ObjectManagerInterface $objectManager)
Definition:
BlockFactory.php:30
Magento\Framework\View\Element
Definition:
AbstractBlock.php:6
Magento\Framework\ObjectManagerInterface
Definition:
ObjectManagerInterface.php:12
Magento\Framework\View\Element\BlockFactory\$objectManager
$objectManager
Definition:
BlockFactory.php:23
Magento\Framework\View\Element\BlockFactory\createBlock
createBlock($blockName, array $arguments=[])
Definition:
BlockFactory.php:43
$block
$block
Definition:
block.php:8
Magento\Framework\View\Element\BlockFactory
Definition:
BlockFactory.php:16
Magento\Framework\View\Element\BlockInterface
Definition:
BlockInterface.php:16
$arguments
$arguments
Definition:
final_price.phtml:24
Magento\Framework\View\Element\Template
Definition:
Template.php:32