I've been using Magento 2 to do some theme development and I'm wracking my brain trying to find documentation for block classes. I've been digging through Block folders and stuff. I'm wondering if there's any documentation for the module Block classes.
Example: I needed to know how to get description from product. I basically had to dig around to see how it was being done for another block and copy Magento\Catalog\Block\Product\View to the block. Is there anywhere I can find the methods of this class?
Thanks for any and all help.
1 Answer 1
I guess what you ask is how do you know what Data you can pull out for given product (Or when you are in category what Category data you can pull out)
Since Views are getting data from it's Model, You need to refer the Model of the given class.
For example in product, you need to look at the Product Model
Magento\Catalog\Model\Product
Or you can even refer Product Data Interface Magento\Catalog\Api\Data\ProductInterface
By this way you can find out what data can be output from any Model
Hope this helps.
-
Thanks for the feedback. This helped me a lot. It may seem simple but in the Magento world things can be very confusing at first.KJ Bonds– KJ Bonds2016年08月10日 20:17:50 +00:00Commented Aug 10, 2016 at 20:17