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
Message
Factory.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Framework\Message
;
8
9
use
Magento\Framework\ObjectManagerInterface
;
10
14
class
Factory
15
{
21
protected
$types
= [
22
MessageInterface::TYPE_ERROR
,
23
MessageInterface::TYPE_WARNING
,
24
MessageInterface::TYPE_NOTICE
,
25
MessageInterface::TYPE_SUCCESS
,
26
];
27
33
protected
$objectManager
;
34
40
public
function
__construct
(
ObjectManagerInterface
$objectManager
)
41
{
42
$this->objectManager =
$objectManager
;
43
}
44
54
public
function
create
(
$type
,
$text
=
null
)
55
{
56
if
(!in_array(
$type
, $this->types)) {
57
throw
new \InvalidArgumentException(
'Wrong message type'
);
58
}
59
60
$className
=
'Magento\\Framework\\Message\\'
. ucfirst(
$type
);
61
62
$message
= $this->objectManager->create(
$className
,
$text
===
null
? [] : [
'text'
=>
$text
]);
63
if
(!
$message
instanceof
MessageInterface
) {
64
throw
new \InvalidArgumentException(
65
$className
.
' doesn\'t implement \Magento\Framework\Message\MessageInterface'
66
);
67
}
68
69
return
$message
;
70
}
71
}
Magento\Framework\Message\MessageInterface\TYPE_NOTICE
const TYPE_NOTICE
Definition:
MessageInterface.php:34
Magento\Framework\ObjectManagerInterface
Definition:
ObjectManagerInterface.php:12
Magento\Framework\Message
Definition:
AbstractMessage.php:6
$text
endifif( $block->getLastPageNum()>1)( 'Page') ?></strong >< ul class $text
Definition:
pager.phtml:43
Magento\Framework\Message\Factory\create
create($type, $text=null)
Definition:
Factory.php:54
$message
$message
Definition:
notifications.php:7
Magento\Framework\Message\MessageInterface
Definition:
MessageInterface.php:14
$type
$type
Definition:
item.phtml:13
Magento\Framework\Message\Factory
Definition:
Factory.php:14
Magento\Framework\Message\MessageInterface\TYPE_SUCCESS
const TYPE_SUCCESS
Definition:
MessageInterface.php:39
Magento\Framework\Message\MessageInterface\TYPE_ERROR
const TYPE_ERROR
Definition:
MessageInterface.php:24
Magento\Framework\Message\MessageInterface\TYPE_WARNING
const TYPE_WARNING
Definition:
MessageInterface.php:29
Magento\Framework\Message\Factory\$types
$types
Definition:
Factory.php:21
Magento\Framework\Message\Factory\__construct
__construct(ObjectManagerInterface $objectManager)
Definition:
Factory.php:40
$className
if($currentSelectedMethod==$_code) $className
Definition:
form.phtml:31
Magento\Framework\Message\Factory\$objectManager
$objectManager
Definition:
Factory.php:33