Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PropertyLocker.php
Go to the documentation of this file.
1 <?php
7 
10 
17 {
21  private $attributeConfig;
22 
26  protected $registry;
27 
33  public function __construct(
35  Config $attributeConfig
36  ) {
37  $this->registry = $registry;
38  $this->attributeConfig = $attributeConfig;
39  }
40 
45  public function lock(\Magento\Framework\Data\Form $form)
46  {
48  $attributeObject = $this->registry->registry('entity_attribute');
49  if ($attributeObject->getId()) {
50  foreach ($this->attributeConfig->getLockedFields($attributeObject) as $field) {
51  if ($element = $form->getElement($field)) {
52  $element->setDisabled(1);
53  $element->setReadonly(1);
54  }
55  }
56  }
57  }
58 }
__construct(Registry $registry, Config $attributeConfig)
$element
Definition: element.phtml:12