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-store
Model
Message
EmptyGroupCategory.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Store\Model\Message
;
8
9
use
Magento\Framework\UrlInterface
;
10
use
Magento\Store\Api\Data\GroupInterface
;
11
use
Magento\Store\Model\ResourceModel\Group\Collection
as GroupCollection;
12
16
class
EmptyGroupCategory
implements
\Magento\Framework\Notification\MessageInterface
17
{
23
private
$collection;
24
30
private
$urlBuilder;
31
37
private
$items =
null
;
38
43
public
function
__construct
(
44
GroupCollection $collection,
45
UrlInterface
$urlBuilder
46
) {
47
$this->collection =
$collection
;
48
$this->urlBuilder = $urlBuilder;
49
}
50
58
public
function
isDisplayed
()
59
{
60
return
!empty($this->getItems());
61
}
62
66
public
function
getIdentity
()
67
{
68
return
'empty_assigned_group_category'
;
69
}
70
74
public
function
getText
()
75
{
76
$items = $this->getItems();
77
$groupLinks = [];
78
foreach
($items as
$group
) {
79
$groupUrl = $this->urlBuilder->getUrl(
'adminhtml/system_store/editGroup'
, [
'group_id'
=>
$group
->getId()]);
80
$groupLinks[] = sprintf(
'<a href="%s">%s</a>'
, $groupUrl,
$group
->getName());
81
}
82
return
__
(
83
'The following stores are not associated with a root category: '
84
. implode(
', '
, $groupLinks) .
'. For the store to be displayed in the storefront, '
85
.
'it must be associated with a root category.'
86
);
87
}
88
92
public
function
getSeverity
()
93
{
94
return
self::SEVERITY_MAJOR
;
95
}
96
102
private
function
getItems()
103
{
104
if
(
null
=== $this->items) {
105
$this->items = $this->collection->setWithoutAssignedCategoryFilter()->getItems();
106
}
107
return
$this->items;
108
}
109
}
Magento\Store\Model\Message\EmptyGroupCategory\getText
getText()
Definition:
EmptyGroupCategory.php:74
$group
$group
Definition:
sections.phtml:16
__
__()
Definition:
__.php:13
Magento\Store\Model\Message
Definition:
EmptyGroupCategory.php:7
Magento\Store\Api\Data\GroupInterface
Definition:
GroupInterface.php:14
Magento\Store\Model\ResourceModel\Group\Collection
Definition:
Collection.php:14
Magento\Store\Model\Message\EmptyGroupCategory
Definition:
EmptyGroupCategory.php:16
Magento\Framework\Notification\MessageInterface\SEVERITY_MAJOR
const SEVERITY_MAJOR
Definition:
MessageInterface.php:23
Magento\Framework\UrlInterface
Definition:
UrlInterface.php:12
Magento\Store\Model\Message\EmptyGroupCategory\getSeverity
getSeverity()
Definition:
EmptyGroupCategory.php:92
Magento\Framework\Notification\MessageInterface
Definition:
MessageInterface.php:19
Magento\Store\Model\Message\EmptyGroupCategory\getIdentity
getIdentity()
Definition:
EmptyGroupCategory.php:66
Magento\Store\Model\Message\EmptyGroupCategory\isDisplayed
isDisplayed()
Definition:
EmptyGroupCategory.php:58
$collection
$collection
Definition:
catalog_category_with_apostrophe_rollback.php:17
Magento\Store\Model\Message\EmptyGroupCategory\__construct
__construct(GroupCollection $collection, UrlInterface $urlBuilder)
Definition:
EmptyGroupCategory.php:43