Drupal 8 User Guide: 6.9. Changing Content Entry Forms

Drupal 8 User Guide: 6.9. Changing Content Entry Forms


Changing Content Entry Forms
with Amber Matz In this tutorial, we’ll walk through the process of
changing content entry forms. By the end of this tutorial, you will understand how to change
the Recipe form to use a different widget to enter
terms into the Ingredients field. To follow along, you should understand how to add a content type, how to
add basic fields to a content type, the concept of taxonomy, and the
concepts of forms and widgets. Also, the Recipe content type
must exist and contain the Ingredients
taxonomy term reference field. See the written version of this tutorial
for links to the prerequisites. From the Manage administrative
menu, navigate to Content, Add content, and Recipe. For the purposes of this
demonstration, I’ve changed the widget for Ingredients to use checkboxes instead of the
default Autocomplete (Tags style). Let’s see how we can change this
form field widget to use an autocomplete field instead which would provide us with a more
compact entry form which would be desirable as the list
of possible ingredients for a recipe could grow to be quite extensive. Back in the Manage administrative
menu, navigate to Structure. Then Content types. And from the Operations menu for
Recipe, Manage form display. Scroll down to the Ingredients field and select
Autocomplete (Tags style). Click Save. Now once again, from the Manage
administrative menu, navigate to Content, Add content, Recipe, and notice that the
Ingredients field now uses the
Autocomplete (Tags style) widget. The Ingredients filed is now a single
text field that accepts multiple values. Now, on your own, create 2 Recipe
content items using recipes of your choice. Make sure that all of the fields have
values including Images, Ingredients, and
Submitted by. See the written version of this tutorial
for further instructions and links to the related tutorials. Here’s an example of a completed
form for Fresh Carrots recipe. In this tutorial, we changed the Recipe form to use a
different widget to enter terms into the Ingredients
field.

Leave a Reply

Your email address will not be published. Required fields are marked *