Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace VendorModuleSetup;
- use MagentoEavSetupEavSetupFactory;
- use MagentoFrameworkSetupInstallDataInterface;
- use MagentoFrameworkSetupModuleContextInterface;
- use MagentoFrameworkSetupModuleDataSetupInterface;
- class InstallData implements InstallDataInterface
- {
- /**
- * EAV setup factory
- *
- * @var EavSetupFactory
- */
- private $eavSetupFactory;
- /**
- * Init
- *
- * @param EavSetupFactory $eavSetupFactory
- */
- public function __construct(EavSetupFactory $eavSetupFactory)
- {
- $this->eavSetupFactory = $eavSetupFactory;
- }
- /**
- * {@inheritdoc}
- */
- public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
- {
- $setup->startSetup();
- $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
- $eavSetup->addAttribute(
- MagentoCatalogModelProduct::ENTITY,
- 'product_profile',
- [
- 'group' => 'My Group',
- 'type' => 'varchar',
- 'input' => 'select',
- 'source' => 'VendorModuleBlockAdminhtmlProductEditTabProfileSelect',
- 'label' => 'Profile',
- 'required' => false,
- 'user_defined' => true,
- 'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
- 'used_in_product_listing' => true,
- ]
- );
- $setup->endSetup();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement