What i want to know is that exactly how much arguments an attribute has and how can we know what each argument does ?

e.g. Consider adding an attribue for customer.

Here's the code where you can find some of the parameters.

$customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, "verified_buyer",  array(
            "type"     => "integer",
            "backend"  => "",
            "label"    => "Verified Buyer",
            "input"    => "checkbox",
            "source"   => "",
            "visible"  => true,
            "required" => false,
            "default" => 0,
            "frontend" => "",
            "unique"     => false,
            "note"       => "",
            "sort_order"       => "100"


Let me know if there is any resource/article about it.

Thanks :)

  • Have you checked addAttribute function definition? you will have idea what are required input – Vishwas Bhatnagar Dec 16 '16 at 5:14
  • Actually, I tried but was not able to track the function. – Sanjay Chaudhary Dec 16 '16 at 5:24

You can find an attribute description in the Magento\Eav module:


The main model for the attribute is Magento\Eav\Model\Attribute. The addAttribute method is defined in the Magento\Eav\Setup\EavSetup class. All properties was mapped to the eav attribute columns in the Magento\Catalog\Model\ResourceModel\Eav\Attribute\PropertyMapper:

 * Map input attribute properties to storage representation
 * @param array $input
 * @param int $entityTypeId
 * @return array
 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
public function map(array $input, $entityTypeId)
    return [
        'attribute_model' => $this->_getValue($input, 'attribute_model'),
        'backend_model' => $this->_getValue($input, 'backend'),
        'backend_type' => $this->_getValue($input, 'type', 'varchar'),
        'backend_table' => $this->_getValue($input, 'table'),
        'frontend_model' => $this->_getValue($input, 'frontend'),
        'frontend_input' => $this->_getValue($input, 'input', 'text'),
        'frontend_label' => $this->_getValue($input, 'label'),
        'frontend_class' => $this->_getValue($input, 'frontend_class'),
        'source_model' => $this->_getValue($input, 'source'),
        'is_required' => $this->_getValue($input, 'required', 1),
        'is_user_defined' => $this->_getValue($input, 'user_defined', 0),
        'default_value' => $this->_getValue($input, 'default'),
        'is_unique' => $this->_getValue($input, 'unique', 0),
        'note' => $this->_getValue($input, 'note'),
        'is_global' => $this->_getValue(

I can't answer all your questions, but I think this information will help you to find the correct way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.