Version:

    Hide element if no data

    You can stop an Element from rendering within your template or component when no data is entered into a specific Drupal field or Component form field. If the website editor doesn't enter anything, you don't want the Element to render.

    For example, you may have an image upload field within your Content type which renders an image into your Content template. If no image is uploaded, you don't want the image element to render anything. You can do this using the 'Hide if no data' option in the Image element.

    To hide an element if no data in field:

    1. Double click on the Element on your Layout canvas you want to hide
    2. Click on the ...ellipsis tab to open the Elements menu
    3. Click on Hide if no data

    4. On the next screen, toggle on Enable
    5. Within the Data field, enter a token for the field you want to check is returning data. If you want to more than one field, enter multiple tokens

    6. If no data is returned, the element (and it's children) will not render.
    DX8 knowledge base icon

    Frequently asked questions

    Get instant answers to common questions. Available online 24/7.

    Find answers

    Raise a ticket icon

    Raise a support ticket

    To raise a ticket, sign into Acquia Cloud and select Help in the top menu.

    Raise support ticket

    Acquia

    Copyright © 2020 Acquia, Inc. All Rights Reserved. Drupal is a registered trademark of Dries Buytaert.