0

can anyone explain uses of this model

1 Answer 1

1

Actually is pretty easy.

source_model usually is used in select and multiselect input types. You can create the class where will return the options of the select/multiselect.

frontend_model is a class that you create so you can manipulate your attribute on frontend, like classes, label (prefixes...), visibility, options nd etc. A really good way to understand better this is looking the function of the abstract class.

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php

backend_model is a class that you create so you can manipulate your attribute on backend, like validations. A really good way to understand better this is also looking the function of the abstract class.

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php

These abstract classes, you should always extend them and use them in your favor, calling the function you want and do what you got to do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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