Blair Wadman 3 minute read

Components of a Drupal site

The three most important elements of Drupal are nodes, blocks and users. Nodes and blocks are important because they are what people see. Users are important because this is how people can administer or be a member of a Drupal website.

Nodes

In Drupal, a node is a primary piece of content. When you create content in Drupal, in most cases you are in fact creating a new node. If you view that content at its URL, you are viewing the full node.

Different types of nodes can be created. These are often referred to as content types. Each content type can have its own set of fields. For example, you could have a blog post content type, with title and body and an image content type with title and image field.

Nodes are stored in the node table in the database and this is one of the most important tables. Each node has a unique ID called the Node ID, or nid for short. When you view a Drupal page, even if you are using an alias, you are actually calling node/nid. For example, the first node will be node/1.

Comments

Comments are generally attached to nodes and are an integral part of encouraging user engagement. In its simplest form, comments can be made against blog posts. But it does not end there. The Drupal Forum module is actually a collection of nodes and comments. Each topic is a node and replies are comments.

Blocks

A block is a secondary piece of content that is usually displayed in regions around the main content, such as the header, sidebars and footer.

Common examples of blocks:

You might occasionally come across a grey area where you are not sure if a particular piece of content should be defined as a block or a node. As a general rule of thumb, if a piece of node is meant to be displayed on multiple pages (not necessarily every page), it probably should be a block.

Users

A user can be anyone who visits a Drupal website. Some users are registered with the website and some are not. If a user is not registered with the website, they are called an anonymous user. A user who is registered is called an authenticated user.

Roles and Permissions

Authenticated users may belong to one or more roles. A role is a set of permissions that all users who belong to it share. For example, a publishing website might have content editors who belong to the editor role. The editor role might have permission to add and edit nodes of a certain type. All users who belong to the editor role will have that permission.

Profile

Each user can have a profile and a profile can have any number of fields.

User Object

User data is stored in the database and is available in the user object.