1

When my custom product type displays, I want a whole new layout/view. I have the content area being removed by nothing shows when I add it back. Can someone tell me what I'm doing wrong?

<referenceContainer name="content" remove="true" />
<referenceContainer name="content">
    <block class="Magento\Framework\View\Element\Template" name="customproductform" template="CustomProductForm::customproductform.phtml"></block>
</referenceContainer>

1 Answer 1

2

it won't work in the way you are doing it.
Once you set remove="true" on a container (or block) that container (or block) will be ignored.
remove doesn't work like a reset button. once you set it, you can start over. It stays in there forever.
You will have to remove all blocks from the container otherwise. unfortunately I don't know yet how to do that.

2
  • It says here devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/… To replace: To replace an element, remove it and add a new one. So, maybe I have to add a new <container name="content"> ?? I tried that though and it didn't work
    – jstrez77
    Commented Mar 10, 2016 at 15:26
  • 2
    Have you tried to do <container name="content"> without removing it prior? In effect replacing it? Commented Mar 10, 2016 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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