Hide element if no data

    You can stop an Element from rendering within your template when no data is entered into a specific Drupal field. This is useful when creating templates which render optional Drupal fields. 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.
    Cohesion DX8 Help center

    Launch our Help center to raise a support ticket or search our knowledge base of common questions and answers.

    DX8 knowledge base icon

    Knowledge base

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

    Find answers

    Raise a ticket icon

    Raise a support ticket

    Log in to the Help center to raise an issue. Available Monday - Friday, 09:00 - 17:00 GMT.

    Raise ticket