Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
product_text_attribute.php
Go to the documentation of this file.
1 <?php
9  ->create(\Magento\Catalog\Setup\CategorySetup::class);
12  ->create(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class);
13 $attribute->setData(
14  [
15  'attribute_code' => 'text_attribute',
16  'entity_type_id' => $installer->getEntityTypeId('catalog_product'),
17  'is_global' => 1,
18  'is_user_defined' => 1,
19  'frontend_input' => 'textarea',
20  'is_unique' => 0,
21  'is_required' => 0,
22  'is_searchable' => 0,
23  'is_visible_in_advanced_search' => 0,
24  'is_comparable' => 0,
25  'is_filterable' => 0,
26  'is_filterable_in_search' => 0,
27  'is_used_for_promo_rules' => 0,
28  'is_html_allowed_on_front' => 1,
29  'is_visible_on_front' => 0,
30  'used_in_product_listing' => 0,
31  'used_for_sort_by' => 0,
32  'frontend_label' => ['Text Attribute'],
33  'backend_type' => 'text',
34  ]
35 );
36 $attribute->save();
37 /* Assign attribute to attribute set */
38 $installer->addAttributeToGroup('catalog_product', 'Default', 'General', $attribute->getId());