Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DisallowUsingHtmlForProductName.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
8 
9 use Magento\Catalog\Setup\CategorySetupFactory;
14 
21 {
25  private $moduleDataSetup;
26 
30  private $categorySetupFactory;
31 
37  public function __construct(
38  ModuleDataSetupInterface $moduleDataSetup,
39  CategorySetupFactory $categorySetupFactory
40  ) {
41  $this->moduleDataSetup = $moduleDataSetup;
42  $this->categorySetupFactory = $categorySetupFactory;
43  }
44 
48  public function apply()
49  {
50  $categorySetup = $this->categorySetupFactory->create(['setup' => $this->moduleDataSetup]);
51  $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
52  $attribute = $categorySetup->getAttribute($entityTypeId, 'name');
53 
54  $this->moduleDataSetup->getConnection()->update(
55  $this->moduleDataSetup->getTable('catalog_eav_attribute'),
56  ['is_html_allowed_on_front' => 0],
57  $this->moduleDataSetup->getConnection()->quoteInto('attribute_id = ?', $attribute['attribute_id'])
58  );
59  }
60 
64  public static function getDependencies()
65  {
66  return [
67  ChangePriceAttributeDefaultScope::class,
68  ];
69  }
70 
74  public static function getVersion()
75  {
76  return '2.1.5';
77  }
78 
82  public function getAliases()
83  {
84  return [];
85  }
86 }
__construct(ModuleDataSetupInterface $moduleDataSetup, CategorySetupFactory $categorySetupFactory)