<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('block_identifier')->toHtml();?>
{{block class="Magento\\Cms\\Block\\Block" block_id="block_identifier"}}
<referenceContainer name="content">
<block class="Magento\Cms\Block\Block" name="block_identifier">
<arguments>
<argument name="block_id" xsi:type="string">block_identifier</argument>
</arguments>
</block>
</referenceContainer>
I have a problem with the xml method. The block is added to the layout, but its'
_toHtml()
is never called, so this block does not appear on the page.EDIT:
My bad, didn't notice name="block_id" was crucial here and didn't need to be changed, as it is an id of the argument!