9.4. Duplicating a View

Last updated on
14 April 2025

Goal

Create a page listing recipes by duplicating the existing Vendors view. Modify the page so that the recipes are displayed in a grid and can by filtered by ingredients.

Site prerequisites

Steps

  1. In the Manage administrative menu, navigate to Structure > Views (admin/structure/views). Find the view "Vendors" and click Duplicate in its dropdown button.

    Duplicate existing view

  2. Name the duplicate "Recipes" and click Duplicate. The view configuration page appears.
  3. Change the title of the view page to "Recipes" by clicking Vendors in the Title section. The Page: The title of this view pop-up appears. Type in "Recipes". Click Apply.

    Change view title

  4. Change from a table to a grid format by clicking Table in the Format section. The Page: How should this view be styled pop-up appears. Check Grid and click Apply. The Page: Style options pop-up appears. Retain the default values and click Apply.
  5. Retain only the title and image fields for the Recipes view by clicking Content: Body in the Fields section. Click Remove in the pop-up that appears.
  6. Change the content type filter to use the Recipe content type by clicking Content: Type (=Vendor) in the Filter criteria section. In the Configure filter criterion: Content: Type pop-up, check Recipe and uncheck Vendor. Click Apply.
  7. Add a further filter that is exposed to visitors by clicking Add in the Filter criteria section. Search for "ingredients" and check "Ingredients (field_ingredients)". Click Add and configure filter criteria.
  8. The appearing pop-up offers extra settings on vocabulary and selection type. Click Apply and continue. The next pop-up allows you to expose this filter to visitors. Fill in the fields as shown below.

    Field name Explanation Example value

    Expose this filter to visitors, to allow them to change it

    Allow visitors to filter and search

    Checked

    Required field

    Whether a value has to be provided or not

    Unchecked

    Label

    Label shown for this filter on the view page

    Find recipes using…

    Expose filter

  9. Change the Path label field to "Recipes" by clicking "/vendors" in the Page settings section. In the pop-up that appears, enter the path "recipes" and click Apply.

    Note that when editing a view, you enter paths without the leading "/", unlike on other administrative pages (such as when providing a path to a content item page).

  10. Change the menu link title by clicking "Normal: Vendors" in the Page settings section. In the pop-up that appears, change the title to "Recipes" and click Apply.
  11. In order to use Ajax (see Ajax entry in the Glossary) to make filtering and paging faster for users, click Advanced to expand the section for more options. In the Other section, change Use Ajax: No to "Yes" by clicking No and checking Use Ajax in the pop-up that appears. Click Apply.
  12. Click Save to save the view.
  13. Go back to the home page and click Recipes in the navigation to view the new Recipes page.

    Recipes view

Expand your understanding

The link to the view in the main navigation will probably not be in the right place. Change the order of the menu items in the main navigation. See Secció 5.8, «Changing the Order of Navigation».

 

This page is generated from AsciiDoc source from the User Guide. To propose a change, edit the source and attach the file to a new issue in the User Guide project. PDF and e-book formats are available on the User Guide project page.

Source file: views-duplicate.asciidoc

Help improve this page

Page status: No known problems

You can: