79236525

Date: 2024-11-29 09:42:28
Score: 1
Natty:
Report link

In your controller, you're fetching the CMS block using the BlockRepository, which is correct. However, in the XML layout file, you need to add a block for rendering that CMS content.

You don’t need to pass the content explicitly in the controller, as the block will automatically fetch the content based on the block_id defined in the XML layout file. So, you can simplify your controller code like this:

Ensure that the Magento_Cms::block.phtml template exists and is properly rendering the block content. Normally, this template should already exist and be capable of rendering any CMS block. However, if you want custom behavior, you can create your own template and specify it in the XML.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Knee Xpert