First, you should examine the column structure of the
catalog_eav_attribute tables. This array is more or less filling in those columns.
The array keys do not necessarily match the column names in each table, that mapping takes place within Magento. For example, in your array you have the key
global which actually maps to the
is_global column of the
catalog_eav_attribute table. If you can figure out which keys map to which columns, the table structure definition will let you know what values are acceptable.
Here is a more complete array from one of my own scripts to get you on the right track.
'group' => 'Some Group',
'label' => 'Uses Domain Registry',
'type' => 'int',
'input' => 'select',
'source' => \MageModule\DomainRegistry\Model\Product\Attribute\Source\UsesRegistry::class,
'backend' => '',
'required' => true,
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
'visible' => false,
'user_defined' => false,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'unique' => false,
'apply_to' => \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE,
'is_used_in_grid' => false,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => false
I should also note that the 'source' and 'backend' keys either accept an empty string or the name of a PHP class. If you are creating a text based attribute that is normally typed in, you do not need a source. However, if you have a choice based attribute such as select dropdown menu or multiselect, you will need a source as it will provide the options for your attribute.
The 'backend' key, can accept either an empty string or a PHP class. This is used when you want to perform some additional processing either just before or after saving or just before or after loading the product. Your question doesn't contain enough info for me to determine if you need this additional processing so it should be safe to assume, for now, that you do not need a backend model.