1

I'm in the process of setting up a theme and have hidden several default elements (breadcrumbs, for example).

Some guides recommend:

<referenceBlock name="breadcrumbs" remove="true" />

whereas others go with:

<referenceBlock name="breadcrumbs" display="false" />

As far as I can tell these do the exact same thing. Does anyone know if there's a difference?

0

1 Answer 1

4
Attribute : remove 
Value     : true/false
  • Allows to remove or cancel the removal of the element. When a container is removed, its child elements are removed as well.
  • The remove attribute is optional and its default value is false.
  • This implementation allows you to cancel removal of a block or container in your layout by setting remove attribute value to true

<referenceBlock name="block.name" remove="true" />

Attribute : display
Value     : true/false
  • Allows you to disable rendering of specific block or container with all its children (both set directly and by reference). The block's/container's and its children' respective PHP objects are still generated and available for manipulation.
  • The display attribute is optional and its default value is true.
  • You are always able to overwrite this value in your layout. In situation when remove value is true, the display attribute is ignored.

<referenceContainer name="container.name" display="false" />
1
  • 1
    Thank you. So, more concisely: one method removes all child elements whereas the other one doesn't? Personally I think your answer should be a lot more succinct. Commented May 22, 2018 at 9:36

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.