0

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.

Rakesh Jesadiya
42.5k19 gold badges135 silver badges186 bronze badges
asked Aug 3, 2016 at 23:17

1 Answer 1

0

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.

answered Aug 4, 2016 at 5:07
1
  • 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. Commented Aug 10, 2016 at 20:17

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.