Site Building

6.9. Changing Content Entry Forms for Drupal 8, 9, and 10

Goal

Change the Recipe form to use a different widget to enter terms in the Ingredients field.

Site prerequisites

The Recipe content type must exist, and it must have an Ingredients taxonomy term reference field. At least one Vendor content item must exist. See Section 6.1, “Adding a Content Type” and Section 6.6, “Setting Up a Taxonomy”.

Steps

Sprout Video
  1. In the Manage administrative menu, navigate to Content > Add content > Recipe (node/add/recipe) to look at the content entry form that is set up by default. Notice how you have to enter ingredients one by one, instead of having a more compact format.
  2. In the Manage administrative menu, navigate to Structure > Content types (admin/structure/types). Then click Manage form display on the dropdown button for the Recipe content type. The Manage form display page appears.
  3. For the Ingredients field, select Autocomplete (Tags style) in the Widget column.

    Image
    Manage the Recipe form

  4. Click Save.
  5. In the Manage administrative menu, navigate to Content > Add content > Recipe (node/add/recipe) to verify the changed behavior of the content form. The Ingredients field is now a single text field that accepts multiple values.

    Image
    Add a recipe

  6. Create two Recipe content items (see Section 5.2, “Creating a Content Item”), such as recipes for "Green Salad" and "Fresh Carrots". Make sure all the fields have values, including images, ingredients, and submitted by (set this to one of the Vendor content items you created in Section 6.3, “Adding Basic Fields to a Content Type”).

Expand your understanding

Change the main site Contact form by navigating in the Manage administrative menu to Structure > Contact forms. For instance, you may want to hide the Send yourself a copy or Language fields.