In magento 2 the image types seem to function as radio buttons, I however want to change one of the types (a custom one) to function as a checkbox, so basically allow multiple images to have this attribute. And then be able to filter them out of the image gallery. I have been looking for a solution and trying out multiple things, but I cant seem to get it done. In magento 2 I have created the type 'Certificate' and I want to be able to assign it to multiple images under a product.
/**
* @inheritdoc
*/
public function apply(): self
{
$this->moduleDataSetup->getConnection()->startSetup();
$eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);
$eavSetup->addAttribute(
Product::ENTITY,
'certificate_image',
[
'type' => 'text',
'label' => 'Certificate',
'input' => 'media_image',
'frontend' => 'Magento\Catalog\Model\Product\Attribute\Frontend\Image',
'global' => ScopedAttributeInterface::SCOPE_STORE,
'filterable' => false,
'visible_on_front' => false,
'used_in_product_listing' => false,
'sort_order' => 100,
'required' => false,
'is_user_defined' => true,
]
);
$this->moduleDataSetup->getConnection()->endSetup();
return $this;
}