Version:

    View item element

    The View items are the individual results (Rows) returned from the View. The layout of the View items are not created directly within the View template because they reference View modes which have their own View mode templates. For example, you can reference the Teaser view mode as your View item and create a template for the teaser.

    You can also use the View item element to render Fields rather than View modes. For more information, see the section below Rendering fields.

    Locating the view item element

    To find the View item element:

    1. Navigate to Site Studio > Templates > View templates
    2. Create or Edit a View template
    3. Click the + button on the Layout canvas
    4. Within the Elements tab, look for the View item element.

    view-item.png

    The View item element includes the following fields:

    View mode

    Within your Site Studio view template you can select the view mode to use for the view results. If you select the view mode within the view template, this will override the view mode selected within your Drupal view settings. If you want to use the view mode selected within your Drupal view settings you need to select Drupal view default within the View mode drop down.

    • Entity type - Select the entity type you are displaying within your view
    • Bundle - Select the bundle your are displaying
    • View mode - Select the View mode to use for the display. Select Drupal view default to use the view mode selected within your view.

    Using multiple view modes. Some views display results from multiple entity types and bundles. For example, search results. When displaying multiple entity types or bundles, you can use Site Studio to choose which display view mode to use for each.

    Comments

    Rendering fields

    You can use the View item element to render Fields rather than Content view modes. The View item will render the Fields using their field formatters. To style or layout the fields, you can place the View item within a Basic container element and apply styles that target helper classes provided by the field formatters.

    To use fields rather than content:

    Step 1: Configure your view

    1. Within your Drupal view settings, within the Format > Show section, select Fields
    2. Add the fields you want to render within the Fields section.

    Step 2: Configure your view template

    To stop your View template from rendering Content view modes, you must remove the View mode section from the View item element within your template.

    1. Within your Site Studio view template, click on the View item element to edit it's settings
    2. Within the settings, click on the Properties button and select Settings within the menu
    3. Click on View mode to deselect it. This will remove it from your View item element
    4. Click Apply and save your View template.

    Your View template will now use the Format settings provided by your View.

    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.