Last active
May 10, 2017 09:58
-
-
Save codekipple/4f4c2eef97623c1360236e13588f36b5 to your computer and use it in GitHub Desktop.
Mangento 2, adding a new image role
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// the group name has to be 'Image Management' rather than 'Image' as it has to match the 'attribute_group_code' rather than the 'attribute_group_name' in the 'eav_attribute_group' table. | |
// See convertToAttributeGroupCode() in \Magento\Eav\Setup\EavSetup | |
$this->eavSetup->addAttribute( | |
\Magento\Catalog\Model\Product::ENTITY, | |
'test_image_role', | |
[ | |
'group' => 'Image Management', | |
'type' => 'varchar', | |
'frontend' => 'Magento\Catalog\Model\Product\Attribute\Frontend\Image', | |
'label' => 'Test image role', | |
'input' => 'media_image', | |
'class' => '', | |
'source' => '', | |
'global' => 0, | |
'visible' => true, | |
'required' => false, | |
'user_defined' => false, | |
'default' => null, | |
'searchable' => false, | |
'filterable' => false, | |
'comparable' => false, | |
'visible_on_front' => false, | |
'unique' => false, | |
] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment