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-eav
Model
Entity
Attribute
Source
AbstractSource.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Eav\Model\Entity\Attribute\Source
;
7
16
abstract
class
AbstractSource
implements
17
\Magento\Eav\Model\Entity\Attribute\Source\SourceInterface,
18
\Magento\Framework\Option\ArrayInterface
19
{
25
protected
$_attribute
;
26
32
protected
$_options
=
null
;
33
41
public
function
setAttribute
(
$attribute
)
42
{
43
$this->_attribute =
$attribute
;
44
return
$this;
45
}
46
53
public
function
getAttribute
()
54
{
55
return
$this->_attribute
;
56
}
57
64
public
function
getOptionText
(
$value
)
65
{
66
$options
= $this->
getAllOptions
();
67
// Fixed for tax_class_id and custom_design
68
if
(
sizeof
(
$options
) > 0) {
69
foreach
(
$options
as
$option
) {
70
if
(isset(
$option
[
'value'
]) &&
$option
[
'value'
] ==
$value
) {
71
return
isset(
$option
[
'label'
]) ?
$option
[
'label'
] :
$option
[
'value'
];
72
}
73
}
74
}
75
// End
76
if
(isset(
$options
[
$value
])) {
77
return
$options
[
$value
];
78
}
79
return
false
;
80
}
81
86
public
function
getOptionId
(
$value
)
87
{
88
foreach
($this->
getAllOptions
() as
$option
) {
89
if
(strcasecmp(
$option
[
'label'
],
$value
) == 0 ||
$option
[
'value'
] ==
$value
) {
90
return
$option
[
'value'
];
91
}
92
}
93
return
null
;
94
}
95
105
public
function
addValueSortToCollection
(
$collection
, $dir = \
Magento
\Framework\Data\
Collection::SORT_ORDER_DESC
)
106
{
107
return
$this;
108
}
109
116
public
function
getFlatColumns
()
117
{
118
return
[];
119
}
120
127
public
function
getFlatIndexes
()
128
{
129
return
[];
130
}
131
140
public
function
getFlatUpdateSelect
(
$store
)
141
{
142
return
null
;
143
}
144
152
public
function
getIndexOptionText
(
$value
)
153
{
154
return
$this->
getOptionText
(
$value
);
155
}
156
163
public
function
toOptionArray
()
164
{
165
return
$this->
getAllOptions
();
166
}
167
}
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\$_options
$_options
Definition:
AbstractSource.php:32
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\getOptionText
getOptionText($value)
Definition:
AbstractSource.php:64
Magento\Framework\Data\Collection\SORT_ORDER_DESC
const SORT_ORDER_DESC
Definition:
Collection.php:23
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\getFlatIndexes
getFlatIndexes()
Definition:
AbstractSource.php:127
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\getFlatColumns
getFlatColumns()
Definition:
AbstractSource.php:116
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\getOptionId
getOptionId($value)
Definition:
AbstractSource.php:86
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\$_attribute
$_attribute
Definition:
AbstractSource.php:25
$attribute
$attribute
Definition:
attribute_set_with_image_attribute.php:41
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\toOptionArray
toOptionArray()
Definition:
AbstractSource.php:163
Magento\Eav\Model\Entity\Attribute\Source
Definition:
AbstractSource.php:6
Magento\Framework\Option\ArrayInterface
Definition:
ArrayInterface.php:11
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\addValueSortToCollection
addValueSortToCollection($collection, $dir=\Magento\Framework\Data\Collection::SORT_ORDER_DESC)
Definition:
AbstractSource.php:105
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\getIndexOptionText
getIndexOptionText($value)
Definition:
AbstractSource.php:152
$value
$value
Definition:
gender.phtml:16
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
Definition:
AbstractSource.php:16
Magento
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\getFlatUpdateSelect
getFlatUpdateSelect($store)
Definition:
AbstractSource.php:140
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\getAttribute
getAttribute()
Definition:
AbstractSource.php:53
$store
$store
Definition:
payment_configuration_rollback.php:33
Magento\Eav\Model\Entity\Attribute\Source\SourceInterface\getAllOptions
getAllOptions()
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\setAttribute
setAttribute($attribute)
Definition:
AbstractSource.php:41
$collection
$collection
Definition:
catalog_category_with_apostrophe_rollback.php:17
$option
$option
Definition:
product_configurable_with_single_child.php:38
$options
$options
Definition:
multiple_mixed_products.php:29