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-catalog
Ui
Component
Listing
Columns
AttributeSetText.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Catalog\Ui\Component\Listing\Columns
;
7
8
use
Magento\Framework\View\Element\UiComponentFactory
;
9
use
Magento\Framework\View\Element\UiComponent\ContextInterface
;
10
use
Magento\Eav\Api\AttributeSetRepositoryInterface
;
11
16
class
AttributeSetText
extends
\Magento\Ui\Component\Listing\Columns\Column
17
{
21
const
NAME
=
'attribute_set_id'
;
22
27
protected
$attributeSetRepository
;
28
36
public
function
__construct
(
37
ContextInterface
$context
,
38
UiComponentFactory
$uiComponentFactory
,
39
AttributeSetRepositoryInterface
$attributeSetRepository
,
40
array
$components
= [],
41
array
$data
= []
42
) {
43
parent::__construct(
$context
,
$uiComponentFactory
,
$components
,
$data
);
44
45
$this->attributeSetRepository =
$attributeSetRepository
;
46
}
47
55
public
function
prepareDataSource
(array $dataSource)
56
{
57
$dataSource = parent::prepareDataSource($dataSource);
58
59
if
(empty($dataSource[
'data'
][
'items'
])) {
60
return
$dataSource;
61
}
62
63
$fieldName = $this->
getData
(
'name'
);
64
65
foreach
($dataSource[
'data'
][
'items'
] as &
$item
) {
66
if
(!empty(
$item
[static::NAME])) {
67
$item
[$fieldName] = $this->
renderColumnText
($item[static::NAME]);
68
}
69
}
70
71
return
$dataSource;
72
}
73
81
protected
function
renderColumnText
(
$attributeSetId
)
82
{
83
return
$this->attributeSetRepository->get(
$attributeSetId
)->getAttributeSetName();
84
}
85
}
Magento\Catalog\Ui\Component\Listing\Columns\AttributeSetText\$attributeSetRepository
$attributeSetRepository
Definition:
AttributeSetText.php:27
Magento\Framework\View\Element\UiComponentFactory
Definition:
UiComponentFactory.php:29
Magento\Ui\Component\Listing\Columns\Column\$uiComponentFactory
$uiComponentFactory
Definition:
Column.php:33
Magento\Framework\View\Element\UiComponent\ContextInterface
Definition:
ContextInterface.php:17
Magento\Catalog\Ui\Component\Listing\Columns
Definition:
AttributeSetText.php:6
Magento\Eav\Api\AttributeSetRepositoryInterface
Definition:
AttributeSetRepositoryInterface.php:14
Magento\Ui\Component\AbstractComponent\getData
getData($key='', $index=null)
Definition:
AbstractComponent.php:264
Magento\Catalog\Ui\Component\Listing\Columns\AttributeSetText
Definition:
AttributeSetText.php:16
Magento\Catalog\Ui\Component\Listing\Columns\AttributeSetText\NAME
const NAME
Definition:
AttributeSetText.php:21
$attributeSetId
$attributeSetId
Definition:
filterable_attributes.php:11
$item
$item
Definition:
partial_invoice.php:27
Magento\Catalog\Ui\Component\Listing\Columns\AttributeSetText\prepareDataSource
prepareDataSource(array $dataSource)
Definition:
AttributeSetText.php:55
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Catalog\Ui\Component\Listing\Columns\AttributeSetText\__construct
__construct(ContextInterface $context, UiComponentFactory $uiComponentFactory, AttributeSetRepositoryInterface $attributeSetRepository, array $components=[], array $data=[])
Definition:
AttributeSetText.php:36
Magento\Catalog\Ui\Component\Listing\Columns\AttributeSetText\renderColumnText
renderColumnText($attributeSetId)
Definition:
AttributeSetText.php:81
Magento\Ui\Component\AbstractComponent\$context
$context
Definition:
AbstractComponent.php:31
Magento\Ui\Component\AbstractComponent\$components
$components
Definition:
AbstractComponent.php:36