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
BlockPool.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\View
;
7
8
use
Magento\Framework\View\Element\BlockFactory
;
9
use
Magento\Framework\View\Element\BlockInterface
;
10
14
class
BlockPool
15
{
20
protected
$blockFactory
;
21
27
protected
$blocks
= [];
28
34
public
function
__construct
(
BlockFactory
$blockFactory
)
35
{
36
$this->blockFactory =
$blockFactory
;
37
}
38
48
public
function
add
(
$name
,
$class
, array
$arguments
= [])
49
{
50
if
(!
class_exists
(
$class
)) {
51
throw
new \InvalidArgumentException(
52
(
string
)
new
\
Magento
\Framework\
Phrase
(
'Invalid Block class name: %1'
, [
$class
])
53
);
54
}
55
56
$block
= $this->blockFactory->createBlock(
$class
,
$arguments
);
57
58
$this->blocks[
$name
] =
$block
;
59
60
return
$this;
61
}
62
69
public
function
get
(
$name
=
null
)
70
{
71
if
(!isset(
$name
)) {
72
return
$this->blocks
;
73
}
74
75
return
$this->blocks[
$name
] ??
null
;
76
}
77
}
Magento\Framework\View\BlockPool\$blocks
$blocks
Definition:
BlockPool.php:27
$block
$block
Definition:
block.php:8
Magento\Framework\View\BlockPool
Definition:
BlockPool.php:14
$class
$_option $_optionId $class
Definition:
date.phtml:13
Magento\Framework\View\BlockPool\__construct
__construct(BlockFactory $blockFactory)
Definition:
BlockPool.php:34
Magento\Framework\View\Element\BlockFactory
Definition:
BlockFactory.php:16
Magento
Magento\Framework\View\Element\BlockInterface
Definition:
BlockInterface.php:16
Magento\Framework\Code\Generator\class_exists
class_exists($className)
Definition:
DefinedClassesTest.php:15
$arguments
$arguments
Definition:
final_price.phtml:24
Magento\Framework\View\BlockPool\add
add($name, $class, array $arguments=[])
Definition:
BlockPool.php:48
Magento\Framework\Phrase
Definition:
Phrase.php:17
Magento\Framework\View
Magento\Framework\View\BlockPool\$blockFactory
$blockFactory
Definition:
BlockPool.php:20
$name
if(!isset($_GET['name'])) $name
Definition:
log.php:14