eavSetupFactory = $eavSetupFactory; $this->executor = $executor; $this->installer = $installer; } /** * {@inheritdoc} */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); $eavSetup->addAttribute( \Magento\Catalog\Model\Product::ENTITY, 'is_featured', [ 'group' => 'Product Details', 'type' => 'int', 'sort_order' => 102, 'backend' => '', 'frontend' => '', 'label' => 'Is Featured?', 'input' => 'boolean', 'class' => '', 'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean', 'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'user_defined' => true, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'used_in_product_listing' => true, 'unique' => false, 'apply_to' => 'simple,configurable,virtual,bundle,downloadable' ]); $this->executor->exec($this->installer); } }