Skip to content

Custom attribute added through $eavSetup->addAttribute not setting frontend_class #3439

Closed
@OLTC-fperrin

Description

@OLTC-fperrin

I tried to set some validation classes for a custom attribute but the frontend_class doesn't seem to get filled in:

$eavSetup->addAttribute(
                \Magento\Catalog\Model\Product::ENTITY,
                'duration',
                [
                    'type' => 'decimal',
                    'label' => 'Duration',
                    'input' => 'text',
                    'class' => 'validate-greater-than-zero',
                    'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
                    'visible' => true,
                    'required' => true,
                    'user_defined' => true,
                    'default' => '1',
                    'searchable' => false,
                    'filterable' => false,
                    'comparable' => false,
                    'visible_on_front' => true,
                    'unique' => false,
                    'used_in_product_listing' => false
                ]
            );

This was inspired by the content of magento/module-catalog/Setup/CategorySetup.php
I tried using class and frontend_class without success
Am I missing something or is it a glitch ? thanks

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions