0

I want to create an empty container and get it rendered. Currently my empty container isn't showing up.

<container name="empty-container" htmlTag="div" htmlClass="my-class"/>
3

An empty container can be forced to render by including a text block.

<!-- Force container to render -->
<block class="Magento\Framework\View\Element\Text">
    <arguments>
        <argument name="text" xsi:type="string"><![CDATA[&nbsp;]]></argument>
    </arguments>
</block>

Thanks to https://gist.github.com/Quinten/47ed93666001938b988d

1
  • this solution doesn't work anymore. – ndlinh Nov 5 '20 at 11:51
0

Add this empty block to container.

<block class="Magento\Framework\View\Element\Text" name="empty-block">
    <action method="setText">
        <argument name="text" xsi:type="string"><![CDATA[&nbsp;]]></argument>
    </action>
</block>

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.