Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
search_attributes_rollback.php
Go to the documentation of this file.
1 <?php
9 
10 $registry->unregister('isSecureArea');
11 $registry->register('isSecureArea', true);
12 
14 $attributesCode = ['test_advanced_search', 'test_quick_search', 'test_catalog_view'];
15 
16 foreach (['test_quick_search', 'test_catalog_view'] as $code) {
17  $attribute = $eavConfig->getAttribute('catalog_product', $code);
18  if ($attribute instanceof \Magento\Eav\Model\Entity\Attribute\AbstractAttribute
19  && $attribute->getId()
20  ) {
21  $attribute->delete();
22  }
23 }
24 $eavConfig->clear();
25 
26 $registry->unregister('isSecureArea');
27 $registry->register('isSecureArea', false);
$code
Definition: info.phtml:12