Decisions about drupal

Architectural decision records tagged with drupal

39 decisions
  1. accepted
    Always provide editors control over image style cropping

    Manual user intervention can help prevent automated cropping from eliminating the most important parts of a photo.

    drupal contrib-modules editorial-experience media
  2. accepted
    Use data-drupal-selector to target form elements in JavaScript

    Classes and IDs are unstable JavaScript targets in Drupal, while data-drupal-selector is a stable hook provided by the Form API.

    drupal front-end javascript
  3. accepted
    Use Tagify for entity autocomplete widgets in Drupal

    Drupal's default entity reference autocomplete widget has limited UX. A modern, well-supported replacement is needed and the Tagify module has been successfully used in several Lullabot projects.

    drupal contrib-modules editorial-experience
  4. accepted
    Only allow developers and site administrators access to the default Drupal files listing

    Drupal's built-in files listing at /admin/content/files is a technical tool that has caused editorial confusion and accidental data loss.

    drupal access-control media editorial-experience
  5. accepted
    Use PHPStan for PHP code static analysis at level 6

    Static analysis catches type errors, logic bugs, and unsafe code paths without running the application, improving code quality at low cost.

    php drupal ci
  6. accepted
    Use 'drush deploy' when building Drupal sites

    When updating Drupal code and configuration in a given environment, it's useful to make sure all members of the team and all teams follow a consistent set of steps, in the same order. Having consistent steps across multiple projects will reduce onboarding for new team members.

    drush drupal deployments
  7. accepted
    Use the term "microcontent" to describe embeddable content from the same website

    Teams have used inconsistent terminology — including "micro-content", "component", "embeds", and "inline content" — to describe content that is embedded within pages but never exists independently.

    drupal content-modeling editorial-experience
  8. accepted
    Use `access_unpublished` for password-protected pages

    Some pages need to be accessible only to specific groups or individuals using a password or token, without requiring a full user account.

    drupal contrib-modules access-control
  9. accepted
    Use Renovate for third-party dependency updates

    Renovate supports automatic updates across a wide variety of ecosystems ensuring our projects are secure and up to date.

    drupal devops security
  10. accepted
    Use human-readable names as exposed filter identifiers in Views
    drupal editorial-experience views
  11. accepted
    Enforce Twig coding standards with automatic linting

    Linters like twigcs keep code more consistent and readable

    twig drupal front-end
  12. accepted
    Use ImageMagick with Drupal

    Drupal requires the GD PHP extension, but many sites prefer ImageMagick for better performance, flexibility, and reliability. This choice affects image features, speed, and deployment in various hosting environments.

    drupal images
  13. accepted
    Use only one h1 on each page

    Using one h1 on each page is best practice for accessibility and usability.

    drupal accessibility
  14. accepted
    Do not use placeholder text in form fields

    Placeholder text introduces significant usability and accessibility issues and should be avoided.

    drupal editorial-experience
  15. accepted
    Order content type form fields based on content priority

    When content types have dedicated pages, matching the display order when possible makes edit forms easier to understand.

    drupal editorial-experience
  16. deprecated
    Standardize the order of steps when building a Drupal site

    When updating Drupal code and configuration in a given environment, it's useful to make sure all members of the team and all teams follow a consistent set of steps, in the same order. Having consistent steps across multiple projects will reduce onboarding for new team members.

    drush drupal deployments
  17. accepted
    Use Typed Entity to encapsulate business logic in dedicated classes

    Wrapping the business logic for an entity using Typed Entity produces code that is easier to read, maintain, test, and discover.

    drupal code quality
  18. accepted
    Leverage view modes when rendering entities

    Rendering entities using view modes have multiple benefits. These include better maintainability, faster initial development time, better performance, and hardened security.

    drupal
  19. accepted
    Use identical cache backends on development environments

    Using memory caches like Memcached or Redis in production but not in development environments can lead to bugs and confusion.

    drupal devops
  20. accepted
    Do not add the Metatag field to the node form

    The metatag field makes the node form slow and overly complex for editorial users.

    drupal node-form editorial-experience performance seo
  21. accepted
    Use Claro for the Drupal administration theme

    Claro offers a modern, responsive, and accessible interface that showcases Drupal's capabilities from the outset.

    drupal editorial-experience
  22. accepted
    Use Type Tray to improve editorial UX

    Drupal's editorial experience in the "Add Content" page is confusing out of the box, especially when the content model's complexity increases.

    drupal contrib-modules editorial-experience
  23. accepted
    Use Simple Add More to improve editorial experience

    Drupal core by default outputs the maximum number of values (cardinality) as empty elements on entity forms, which usually represents a poor user-experience.

    drupal contrib-modules editorial-experience
  24. accepted
    Break composer install if patches don't apply

    Allowing builds to succeed with failed patches can lead to malformed code or hidden errors.

    drupal composer php
  25. accepted
    Use local copies of patch files

    When using cweagans/composer-patches, it is important that patch sources are consistent and do not change between builds.

    drupal php composer
  26. accepted
    Store Composer Patches configuration in composer.json

    Validating a complete Composer configuration is important to ensuring build issues are caught early.

    drupal php composer
  27. accepted
    Configure Composer Patches to Use `-p2` as `patchLevel` for Drupal core

    Drupal's git repository has a different directory structure than projects built on Drupal. Default Composer Patches settings can cause Drupal patches to be silently misapplied.

    drupal php composer
  28. accepted
    Always hide non-translatable fields on translation forms

    When content translation is enabled, it's possible to decide which fields can be translated.

    drupal
  29. accepted
    Lock entity language on edit forms

    Editors new to Drupal often try to translate content by changing the language on existing content, causing confusion for site visitors.

    drupal
  30. accepted
    Consistently name entity fields

    Adopting a consistent set of rules when naming entities in Drupal can reduce errors and improve maintainability.

    drupal
  31. deprecated
    Composer patches configuration and best practices

    Default composer-patches settings can lead to misapplied patches or hidden errors. Using a consistent configuration across projects will reduce errors and save time.

    drupal php composer
  32. accepted
    Use PHPUnit for unit testing PHP code
    drupal php coding testing
  33. accepted
    Block the Drupal user 1 account in production environments

    The first user account in a Drupal site (often referred to as "administrator" or "user 1") is granted every permission automatically. If the account credentials are compromised, an attacker can easily inject JavaScript to attack site visitors and can likely execute arbitrary PHP code.

    drupal security
  34. accepted
    Always use typehints in new PHP code

    Following stricter typing where available can significantly reduce bugs, and simplify maintainability. This has been proven by several studies across different disciplines.

    drupal php coding
  35. accepted
    Confirm Drupal site configuration is always in a default state

    Configuration should never be in an overridden state after configuration import(s) have been completed.

    drupal deployment automation devops
  36. accepted
    Use DDEV for local environments

    The software development industry is continuing to move to containers both for production and local environments. It's clear that the bulk of new investment in local tooling is going towards container-focused solutions. While containers themselves add some complexity to local environments, they also reduce variance in development environments for teams with multiple developers.

    dev-tools drupal devops
  37. accepted
    Use strict types in PHP code

    PHP's type coercion can cause logical errors within a program. For example, when a float is cast to an int, the decimal portion is lost. We aim to reduce these errors in our code, but they can easily slip through manual code review. Following stricter typing where available can significantly reduce bugs, as shown by Python's urllib3 type hinting case study.

    php drupal
  38. accepted
    Stage File Proxy for static files

    Lullabot often works on projects that have large numbers of static file assets in production, such as images or PDFs. Keeping a complete copy of those files for each environment is wasteful, since developers tend to only look at a small portion of a site locally. A solution is needed to reduce disk use and the time it takes to update an environment.

    devops locals drupal contrib-modules
  39. accepted
    Use settings.php for environment overrides and local settings

    When developing a Drupal website, additional modules and configuration are useful for local and development environments.

    dev-tools drupal

Search Decisions