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?

  • Did you ever get this working? – LM_Fielding Apr 10 '17 at 13:20
  • 1
    Still no. Any thoughts you have? – jjordao May 22 '17 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. – LM_Fielding May 22 '17 at 13:18
  • bit.ly/2BTcLJ5 using the link you can get CMS block result – Rakesh Jesadiya Aug 28 '18 at 17:58
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, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.