free
web stats

Fill the form & Get Installation Support

Connect With Us





captcha

Connect With Us





captcha

How to get CMS Block Collection in Magento 2

You can get all the CMS Static Blocks collection in Magento 2 by using interface, Magento\Cms\Api\BlockRepositoryInterface.

Magento\Cms\Api\BlockRepositoryInterface is used for getting CMS Static Blocks related data in Magento 2.

You need to instantiate Magento\Cms\Api\BlockRepositoryInterface in __construct() method of Class

From Template file, you can access all the Static Blocks by iterating over a loop on a collection.

After using the above code snippet you can get all the Cms Static Blocks from a store.

Was this article helpful?
YesNo
Fill the below form if you have any Magento programming need.




captcha