Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Config.php
Go to the documentation of this file.
1 <?php
7 
9 
17 {
26  public function __construct(
27  \Magento\Eav\Model\Entity\Attribute\Config\Reader $reader,
28  \Magento\Framework\Config\CacheInterface $cache,
29  $cacheId = 'eav_attributes',
30  SerializerInterface $serializer = null
31  ) {
32  parent::__construct($reader, $cache, $cacheId, $serializer);
33  }
34 
42  {
43  $allFields = $this->get(
44  $attribute->getEntityType()->getEntityTypeCode() . '/attributes/' . $attribute->getAttributeCode()
45  );
46 
47  if (!is_array($allFields)) {
48  return [];
49  }
50  $lockedFields = [];
51  foreach (array_keys($allFields) as $fieldCode) {
52  $lockedFields[$fieldCode] = $fieldCode;
53  }
54 
55  return $lockedFields;
56  }
57 
64  public function getEntityAttributesLockedFields($entityCode)
65  {
66  $lockedFields = [];
67 
68  $entityAttributes = $this->get($entityCode . '/attributes');
69  foreach ($entityAttributes as $attributeCode => $attributeData) {
70  foreach ($attributeData as $attributeField) {
71  if ($attributeField['locked']) {
72  $lockedFields[$attributeCode][] = $attributeField['code'];
73  }
74  }
75  }
76 
77  return $lockedFields;
78  }
79 }
__construct(\Magento\Eav\Model\Entity\Attribute\Config\Reader $reader, \Magento\Framework\Config\CacheInterface $cache, $cacheId='eav_attributes', SerializerInterface $serializer=null)
Definition: Config.php:26
getLockedFields(AbstractAttribute $attribute)
Definition: Config.php:41
$attributeCode
Definition: extend.phtml:12