I am attempting to load a static block from my controller – but am having trouble locating the right syntax for doing this.
What is the proper syntax to load a CMS block by identifier or block id and what factory supports this type of loading?
cms-blockmagento2
I am attempting to load a static block from my controller – but am having trouble locating the right syntax for doing this.
What is the proper syntax to load a CMS block by identifier or block id and what factory supports this type of loading?
Best Answer
On __construct function,you need inject
\Magento\Cms\Model\Template\FilterProvider
\Magento\Store\Model\StoreManagerInterface
\Magento\Cms\Model\BlockFactory
for getting data.
You can try below as example