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
Backend
ArrayBackend.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Eav\Model\Entity\Attribute\Backend
;
7
14
class
ArrayBackend
extends
\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
15
{
22
public
function
beforeSave
($object)
23
{
24
$attributeCode
= $this->
getAttribute
()->getAttributeCode();
25
$data
= $object->getData(
$attributeCode
);
26
if
(is_array(
$data
)) {
27
$data
= array_filter(
$data
,
function
(
$value
) {
28
return
$value
===
'0'
|| !empty(
$value
);
29
});
30
$object->setData(
$attributeCode
, implode(
','
,
$data
));
31
}
32
33
return
parent::beforeSave($object);
34
}
35
42
public
function
validate
($object)
43
{
44
$attributeCode
= $this->
getAttribute
()->getAttributeCode();
45
$data
= $object->getData(
$attributeCode
);
46
if
(is_array(
$data
)) {
47
$object->setData(
$attributeCode
, implode(
','
, array_filter(
$data
)));
48
}
elseif
(empty(
$data
)) {
49
$object->setData(
$attributeCode
,
null
);
50
}
51
return
parent::validate($object);
52
}
53
}
Magento\Eav\Model\Entity\Attribute\Backend
Definition:
AbstractBackend.php:7
elseif
elseif(isset( $params[ 'redirect_parent']))
Definition:
iframe.phtml:17
Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend\getAttribute
getAttribute()
Definition:
AbstractBackend.php:81
Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend\beforeSave
beforeSave($object)
Definition:
ArrayBackend.php:22
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
$value
$value
Definition:
gender.phtml:16
$attributeCode
$attributeCode
Definition:
extend.phtml:12
Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend
Definition:
ArrayBackend.php:14
Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend\validate
validate($object)
Definition:
ArrayBackend.php:42