0

I have a problem with the page builder on my custom module. In the adminhtml, everything is working fine, and my code propeller is saved to DB, but when I'm trying "echo" my code, the widget isn't displayed. I can see for example {{widget type="Magento\Cms\Block\Widget\Page\Link" anchor_text="test" title="test" template="widget/link/link_block.phtml" page_id="1"}} instead of my widget. Does anyone know how to render this code?

1 Answer 1

0

I fixed this issue this is a code:

   public function generateHtmlWithWidgets($html): string
{
    return $this->getCmsFilterContent($html);
}

private function getCmsFilterContent($value = ''): string
{
    return $this->filterProvider->getPageFilter()->filter($value);
}

public function _prepareLayout(): Column
{
    return parent::_prepareLayout();
}

and on .phtml file

  $pageBuilder = $block->getPageBuilder();
  echo $block->generateHtmlWithWidgets($pageBuilder);

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.