1

I have developed a custom slider for Magento 2. The fields for my slider in the backend are; Title, Image and Content. The Content is a Wysiwyg editor and I am trying to make it work like a CMS Page content where I can add codes like:

{{block class="Magento\Framework\View\Element\Template" name="new.template" template="mytemplate.phtml"}}

What classes do I need to call in my block constructor to output the same results as that of CMS pages?

4
  • Did you ever get this working? Commented Apr 10, 2017 at 13:20
  • 1
    Still no. Any thoughts you have?
    – jjordao
    Commented May 22, 2017 at 7:21
  • No, sorry also hoping to do something like this for simplicity. MazeStricks is definitely a move in the right direction. My idea is use his suggestion and call the block by code rather than an id which will probably change with migrations etc. Please tell me if you get it. Commented May 22, 2017 at 13:18
  • bit.ly/2BTcLJ5 using the link you can get CMS block result Commented Aug 28, 2018 at 17:58

1 Answer 1

1

try to inject the class Magento\Cms\Model\BlockFactory $blockFactory in your constructor, Hope this helps.

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.