Setting up a Taxonomy
0 (0 Likes / 0 Dislikes)
Setting up a Taxonomy
with Amber Matz
In this tutorial we'll walk through the
process of setting up a taxonomy
for use in a content type.
By the end of this tutorial, you will
understand how to
create an Ingredients vocabulary
and add it to the Recipe content type
as a field that can contain an
unlimited number of values
and that allows adding new terms
to the vocabulary.
To follow along, you should
understand the concepts
of content entities and fields,
taxonomy, and how to add a field
to a content type.
Also, the Recipe content type
must exist.
See the written version of this tutorial
for links to the prerequisites.
In the Manage administrative menu,
navigate to Structure,
then Taxonomy.
This is the path
admin/structure/taxonomy.
You will see the tags Vocabulary that
was created
with the core standard installation
profile.
Click Add vocabulary.
For the Name field, which is the
name of the vocabulary,
fill in Ingredients as a value.
For Description, which is a brief note
about the vocabulary, leave blank.
Click Save.
You'll be taken to the Ingredients page
which shows a list of all the terms in
this vocabulary, if there were any.
Now we can create new terms.
Click Add term.
Enter Butter in the name field,
then click Save.
You will receive a confirmation about
the term you created
and be returned to the Add term
content form.
Let's create a couple more terms.
For example, Eggs and Milk.
You can return to this Vocabulary
and create more terms later.
Let's head back to the Ingredients
vocabulary.
Now let's add a Taxonomy field to the
Recipe content type.
In the Manage administrative menu,
navigate to Structure, Content types.
Click Manage fields for your Recipe
content type.
Click Add field.
Select the drop-down under
Add a New Field
and select under Reference,
Taxonomy Term.
Give it a Label of Ingredients.
Click Save and Continue.
For Type of item to reference, which
is the type of entity
that is referenced by the field,
select Taxonomy term.
For Allowed number of values,
which is the number of values
a user can enter,
enter Unlimited.
Click Save field settings.
On the next configuration screen
for Label, keep the Ingredients label
for Help text, which is help shown to
users creating content,
let's put, Enter ingredients that site
visitors might want to search for.
We'll leave the Required field
unchecked and we'll also skip
Default value.
Under Reference Type, and
Reference Method,
which allows us to select the method
used to choose allowed values,
select Default.
Also check Create referenced entities
if they don't already exist.
This will be useful for this vocabulary
because a content editor will be able
to add new ingredients
to the ingredients vocabulary as they
are creating new recipes.
As the content editor is typing an
ingredient,
the Auto Complete field, if it is used,
will display any matches
to existing ingredients.
However, the downside to this option
is that you might end up
with multiple variations of terms or
even misspellings that should instead
be represented by one term.
So keep that in mind.
Next we need to select Available
vocabularies
which is the vocabulary to choose
allowed values from.
We'll choose the Ingredients vocabulary.
Click Save settings.
You will be taken back to the Manage
fields page.
A message will be displayed saying
that the Configuration for Ingredients
is complete.
In this tutorial, we created an
Ingredients vocabulary
and added it to the Recipe content
type as a field that can contain
unlimited number of values
and that allows
adding new terms to the vocabulary.