Drupal 8 User Guide: 6.1. Adding a Content Type

Drupal 8 User Guide: 6.1. Adding a Content Type


Adding a Content Type
with Amber Matz In this tutorial, we’ll walk through how
to add a new content type. By the end of this tutorial you will
understand how to add and configure a new content type Vendor for
our demo site. To follow along, you should
understand the concepts of content entities and fields and you
should have a plan in place for your content structure. See the written version of this tutorial for links to these prerequisite
tutorials. In the Manage administrative menu,
navigate to Structure, then Content types. This page can also be accessed
through the path admin/structure/types. The Content types page appears
showing all the available types of content
currently on the site. Click Add content type. The Add content type page appears and we can fill in the fields
as follows. For Name, let’s enter Vendor. A machine name for this content type
is automatically generated based on the name. You can edit that by clicking the Edit
button next to the machine name. The Description field is used to
explain the use of the content type. Let’s fill in, Information about
a vendor. In the vertical tab labeled Submission
form settings, we can configure the form that is
used for creating and editing content of the Vendor type. The Title field label is the label of
the Title field that is shown when editing or creating content of
this type. Let’s change Title to Vendor name. Preview before submitting allows you
to choose whether you should allow content
creators to preview the content before submitting. The options are: Disabled, which
means no Preview button would be provided anyone creating
or editing this content. Optional, which provides a Preview
button to content editors along with the regular Save/submit
button. And Required, in which editors are
forced to preview content before it can be saved or published. Let’s select Optional. This will allow content creators to
preview the content when they are ready to, rather than
forcing them to always preview before saving
content. The Explanation or submission
guidelines field allows you to provide instructions for
creating or editing content. Anything you put here will be
displayed at the top of the page when someone is creating or editing
content of this type. We’ll leave this field blank but, keep
in mind, it can be a useful place to add Help
text for your content editors. Let’s move on to the next vertical tab,
Publishing options. This is where we decide on default
options for new content of this type. The Published checkbox allows you
to decide whether to make the content item publish by default
when the content is saved. Let’s keep this box checked to make
vendor pages published by default. But a content editor can uncheck this
box before saving their content to save a draft. We’re only setting the default value
for the content type, not the only value. Next is the Promoted to front page
field. In a default website, this setting can
be used to show content on the home page
in a “River of News” format. We’ll leave the default value as
unchecked. This field could also be useful as a
filter when configuring views or lists of content that only appear
on the front page. And if the site is configured as such,
can provide a way for content editors to easily promote content. Next we have Sticky on top of lists. In a default website this setting can
be used to keep content on top of a list. It can also be useful as a filter
when configuring views. We’ll leave this unchecked as well
for the default value. Finally, in this vertical tab, we have
Create new revision. By leaving this on by default, we can
better ensure that a new revision is created each
time the Vendor content item is being edited. Note that changing these settings
does not affect the content items that have already been created. So this is a good task for the
beginning of your site build before any content has been created. Let’s move on to the next vertical tab,
Display settings. This tab contains the field Display
author and date information, which, when checked, will display the
author’s user name and the content publication date on
each vendor page. However, we don’t want that, so let’s
turn it off. Next we have Menu settings. Available menus allows us to decide
which menus that this type of content
can be added to. Vendors do not need to appear in
menus so let’s uncheck all the menu options. Since we are not adding any content
to a menu by default, we don’t set the default parent item
either. But when you check an Available menu, you’ll need to select a parent item
as well. OK, we’ve configured all the defaults
for the Vendor content type. Click Save and manage fields to
save the content type and move on to adding and
editing fields. We’re then directed to the Manage
fields tab, which is where we can add fields to
our content type but we’re going to save this task
for a separate tutorial. Now go ahead and return to Content
types and add a new content type for
Recipes. See the written version of this tutorial
for further instructions and specific values. But the general process is the same
as what we have just walked through. In this tutorial we walked through the
steps of how to add a new content type Vendor. On your own, create a content type,
Recipe. See the written version of this tutorial
to refresh your memory of the process and for values specific
to the Recipe content type.

About the author

Leave a Reply

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