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?

3
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" />
|improve this answer|||||
  • 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. – user7290573 May 22 '18 at 9:36

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.