Updated on 14 October 2017

This is not Drupal specific, but it applies specifically to Drupal due to the freedom that it allows.

Drupal provides label and machine name (e.g. for content types Article and article, Basic Page and page).

Normalizing the way you are name content types, fields, vocabularies, roles, image styles, clean url's... have several benefits:

  • Improve reusability
  • Improve readability
  • Facilitate project onboarding for other collaborators

Here are some rules that can be easily adopted. It should be regarded as a first idea: read the rule then build your own.

Fields

Fields are everywhere: content types, vocabularies, users, blocks, ... so let's start with that.

  • No entity type prefix, field names should remain short and could be used by another entity type (e.g. for a flag, do not use document_status, but status).
     
  • No plural, following the same rule than SQL tables (btw fields are SQL tables). Multiplicity can change over time (e.g. not field_files but field_file).
     
  • For entity reference, simply use the machine name of the reference (e.g. document_type).
     
  • For fields that are specialized by a module (e.g. Telephone or Link), use the name of the module machine name (telephone, link).

Content types

Avoid to be too generic... or too specific.
Being too generic will give a vague idea and could lead to hesitation from the author.
Being too specific will lead to too many content types.

Provide a description for your content type first, the name will come by itself.

Example: Event, Document.

Roles

Roles should be defined from the use case of the website. Having personas will help here.

A community of authoring users could be defined by

  • Editor: person that can review and publish content
  • Author: person that can write content and send it to the editor

A real estate website could be defined by

  • Promoter: project manager of a building that can edit properties content.
  • Agency: sales representative that can edit sales status for properties.

[ This section needs to be completed, see the project roadmap for this site. ]

  • Image styles
  • Clean URL's
  • File directories from File or Image fields.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Only images hosted on this site may be used in <img> tags.
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.