Skip to content

TutorialFor site builders, module developersDrupal 11

Your first hour, no code

Before you write a line of PHP, you should know what Drupal already does, because the most expensive custom code is the code that rebuilds a core feature. This tutorial spends one hour on a fresh Standard-profile site building a small events section entirely in the admin UI.

An events section for a site: an Event content type with a date field, two event nodes, a page at /events listing them, a sidebar block showing the same list, a landing page composed visually in Drupal Canvas, and a second user account that can edit content but not administer the site. Along the way you meet the admin subsystems (content types, fields, Views, blocks, Canvas, users) that every Drupal developer leans on daily.

  • A fresh Drupal 11 site installed with the Standard profile, per Install Drupal core.
  • You are logged in as the admin account created during installation.

These docs describe Claro, the default admin theme, and the Navigation sidebar that the Standard profile installs.

Look at the sidebar on the left. Its top section deals with content: Content, Files, and Blocks, plus a Create menu that gains one link per content type. Below it sits the administration section, which is where the structure of the site lives:

  • Structure/admin/structure: content types, block layout, menus, taxonomy, views. You will spend most of this hour here.
  • Appearance/admin/appearance: themes. Olivero is the default front-end theme, Claro the admin theme.
  • Extend/admin/modules: the module list. Everything you use this hour (Node, Field UI, Views, Block) is a core module that Standard installed for you.
  • Configuration/admin/config: settings for everything, grouped by topic.
  • People/admin/people: users, roles, and permissions.
  • Reports/admin/reports: status report and logs.

Visit Administer → Structure → Content types/admin/structure/types. The list is empty: Standard ships no content types, so every site defines its own content model from the start. You are about to add the first one.

A content type is a bundle: a named shape for content, with its own fields, form, and display. You define it once; editors then create any number of nodes of that shape.

  1. On Administer → Structure → Content types, select Add content type.
  2. Enter Event in the Name field. Drupal generates the machine name event; this is what code and URLs will use.
  3. In the Description field, enter A scheduled happening with a date and a venue. Editors see this on the content creation screen.
  4. Under Display settings, uncheck Display author and date information. Events are not blog posts; the posting byline is noise.
  5. Select Save and manage fields.

You land on the Manage fields screen for the new type. Its table is empty: a new type starts with only the built-in fields every node has (title, author, published status), which this table does not list. Every content type gets four tabs that you should learn now: Edit (the type’s settings), Manage fields (what data it stores), Manage form display (what the editing form looks like), and Manage display (what visitors see).

Fields are where Drupal stores structured data, and they belong to the content type, not to individual nodes.

  1. On the Manage fields screen/admin/structure/types/manage/event/fields, select Create a new field.
  2. Choose Date and time as the field type, then the Date option.
  3. Enter Event date as the label. The machine name becomes field_event_date.
  4. Continue to the field settings. Set Allowed number of values to 1 (the default) and leave the date type as Date and time.
  5. Mark the field as Required, then select Save settings.

Notice what you did not do: no database migration, no schema file, no form code. The field system created the storage, added the widget to the editing form, and added a formatter to the display. The same field system powers every entity in Drupal, which is why Entities, bundles, and fields is the first concept page worth reading when you start writing code.

  1. From the sidebar, select Create, then Event (/node/add/event).
  2. Enter Spring meetup as the title, pick any future date for Event date, and select Save.
  3. Create a second event named Summer hackathon with a later date.

You are looking at the published nodes as visitors would see them, themed by Olivero. Each node has a URL like /node/1; the URL alias system under Administer → Configuration → Search and metadata → URL aliases can give them friendlier paths, and editors can set one per node in the sidebar of the editing form.

Step 5: Build the events listing with Views

Section titled “Step 5: Build the events listing with Views”

You need a page that lists events. In most frameworks this is your first controller and template. In Drupal it is a view: a configuration-defined query plus display, built in the admin UI. Views is not a convenience layer to outgrow; core itself defines its content listings, including the /admin/content page you used in the last checkpoint, as views.

  1. Go to Administer → Structure → Views/admin/structure/views and select Add view.
  2. Enter Events as the view name.
  3. Under View settings, show Content of type Event sorted by Newest first.
  4. Check Create a page. Set the page title to Events and the path to events.
  5. Check Create a block as well, with the display format Unformatted list of titles (linked), showing 5 items. The block reuses the same query for Step 6.
  6. Select Save and edit, then visit /events.

The wizard gave you a working page; the edit screen it returned to is the real tool. Filters, sorts, fields, pagers, access, and the page path are all editable there. Change the sort to use Event date instead of the authored date: under Sort criteria, add Event date, select ascending order, remove the “Authored on” sort, and save. The listing now orders by when events happen, not when they were entered.

Blocks are reusable chunks of output placed into theme regions. Your view created a block display; nothing shows until you place it.

  1. Go to Administer → Structure → Block layout/admin/structure/block. The page lists the regions of the current front-end theme, Olivero.
  2. Find the Sidebar region and select Place block next to it.
  3. Search for Events, find the block named after your view, and select Place block.
  4. In the block settings, uncheck Display title if you prefer a quieter sidebar, leave visibility conditions empty, and select Save block.
  5. Select Save blocks at the bottom of the layout page.

Visibility conditions are worth a second look before you move on: a block can be restricted by content type, by page path, or by the viewer’s role, all without code. When you later write a custom block plugin, placement and visibility work exactly the same way.

Step 7: Compose a landing page with Drupal Canvas

Section titled “Step 7: Compose a landing page with Drupal Canvas”

Content types and views give you structure. Drupal Canvas is where pages come together: a visual editor in which you drag components onto a page and see the result as you build. Everything you built so far shows up there as a building block.

Canvas is a contributed module, so add it to the project first:

Terminal window
ddev composer require drupal/canvas
ddev drush pm:install canvas -y
  1. Go to Administer → Content → Pages/admin/content/pages and select Add Page. The Canvas editor opens on a blank page.
  2. Enter Welcome as the page title.
  3. Open the Library panel on the left. It lists every component Canvas can place, including the block display of your Events view.
  4. Drag the Events block onto the page. The editor renders your real events in place.
  5. Publish the page, then open it on the front end.

This is the same block you placed in the sidebar, now placed by an editor on a single page. Components can come from blocks, from your theme’s single-directory components, or from a JavaScript front end; Canvas Headless shows the last of these.

So far you are user 1, the account that bypasses all permission checks. Real sites give people the least access that does their job, and Standard ships a role for exactly this.

  1. Go to Administer → People/admin/people and select Add user.
  2. Fill in an email address, the username editor, and a password.
  3. Under Roles, check Content editor, then select Create new account.

There is a catch, and it is deliberate: the Content editor role that Standard ships carries no per-type node permissions at all. It grants the surrounding privileges an editor needs (the content overview, revisions, URL aliases, the admin theme), but not the right to create or edit any particular content type. So nobody but the admin can create events yet. Permissions in Drupal are always granted explicitly, per role, per operation, and usually per bundle:

  1. Go to the Permissions tab/admin/people/permissions and find the Node section.
  2. For the Content editor column, check Event: Create new content, Event: Edit own content, and Event: Delete own content, then select Save permissions.
  3. Open a private browser window and log in as editor.

As the editor, the admin menu offers content creation and editing, but no Structure, Extend, or Configuration. Visit /admin/structure directly and you get “Access denied”: permissions gate routes, not menu visibility. The permission model is covered in Access: users, roles, and permissions.

The new content type does not appear in the Create menu

Section titled “The new content type does not appear in the Create menu”

The Navigation sidebar’s links are cached. They normally refresh when you save the content type, but if the Event link is missing, rebuild caches: Administer → Configuration → Development → Performance, Clear all caches (or ddev drush cache:rebuild from the terminal).

The view’s default filters are Content type = Event and Published = Yes. Check that your events are published (/admin/content shows status) and that the filter targets the right type. If you created the events before saving the view’s filters, refresh the page; views query live, so stale results mean filters, not caching.

You are editing the block layout of a different theme. The Block layout page has one tab per installed theme; make sure the Olivero tab is active. The admin theme Claro has its own, different regions.

I see a toolbar at the top instead of a sidebar

Section titled “I see a toolbar at the top instead of a sidebar”

Your site runs Drupal 11.3 or earlier, where the Standard profile installed the Toolbar module. Every path in this tutorial is unchanged; reach them through the top toolbar’s Manage menu instead. See the version callout in the prerequisites.

Content types already lists Article and Basic page

Section titled “Content types already lists Article and Basic page”

Your site runs Drupal 11.3 or earlier, where the Standard profile created those two types and granted the Content editor role permissions for them. Ignore them and follow the steps as written; Event works the same alongside them. On Drupal 11.2 and earlier, a new content type also gets a Body field automatically.

Was this page helpful?

Drupal is a registered trademark of Dries Buytaert.