<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
  <title>Lullabot&#39;s Architecture Decisions — Lullabot</title>
  <subtitle>A collection of processes, designs, and tools our team has standardized on.</subtitle>
  <link href="https://architecture.lullabot.com/feed.xml" rel="self" />
  <link href="https://architecture.lullabot.com/" />
  <updated>2026-08-07T00:00:00Z</updated>
  <id>https://architecture.lullabot.com/</id>
  <author>
    <name>Lullabot</name>
  </author>
  <rights>2026 Lullabot, Inc. CC-BY 4.0.</rights>
  <entry>
    <title>Enforce SDC Schema Validation</title>
    <link href="https://architecture.lullabot.com/adr/20260807-sdc-enforce-schema-validation/" />
    <updated>2026-08-07T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260807-sdc-enforce-schema-validation/</id>
    <summary type="html">Without enforced schema validation, Single Directory Components can silently accept incorrect or missing props, leading to runtime errors and inconsistent rendering.</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="sdc" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Enable &lt;code&gt;enforce_prop_schemas: true&lt;/code&gt; in the theme&#39;s &lt;code&gt;.info.yml&lt;/code&gt; to require schema validation for all SDC components.&lt;/p&gt;
&lt;h2 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h2&gt;
&lt;p&gt;Projects still migrating legacy templates to SDC may defer enforcement until migration is complete.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Invalid or missing props are caught during development rather than silently failing&lt;/li&gt;
&lt;li&gt;Component contracts are enforced, improving reliability across teams&lt;/li&gt;
&lt;li&gt;Requires every SDC to have a valid &lt;code&gt;*.component.yml&lt;/code&gt; schema before it will render&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;additional-resources&quot; tabindex=&quot;-1&quot;&gt;Additional Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.drupal.org/docs/develop/theming-drupal/using-single-directory-components/creating-a-single-directory-component&quot;&gt;Drupal.org: Creating a single-directory component&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Load JavaScript libraries conditionally</title>
    <link href="https://architecture.lullabot.com/adr/20260806-conditional-library-loading/" />
    <updated>2026-08-06T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260806-conditional-library-loading/</id>
    <summary type="html">Loading all JavaScript globally increases initial page weight and slows down pages that don&#39;t need it.</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="javascript" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Attach JavaScript libraries at the entity or component level using Drupal&#39;s libraries API so they only load when the content that needs them is present on the page.&lt;/p&gt;
&lt;p&gt;For example, a video paragraph template should declare the Vimeo API as its own library dependency rather than loading it site-wide.&lt;/p&gt;
&lt;p&gt;SDC components already handle this for co-located CSS and JS, which are auto-discovered and loaded only when the component renders.&lt;/p&gt;
&lt;h2 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h2&gt;
&lt;p&gt;Libraries required on every page (analytics, error tracking, global navigation) should remain in the theme or module global library. When in doubt, measure: if a library is used on more than 80% of pages, global loading may be simpler without meaningful performance cost.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Initial page load is lighter — JavaScript only loads when needed&lt;/li&gt;
&lt;li&gt;Entity and paragraph templates become responsible for declaring their own library dependencies&lt;/li&gt;
&lt;li&gt;Developers must verify that conditionally loaded libraries are attached in all relevant templates&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;additional-resources&quot; tabindex=&quot;-1&quot;&gt;Additional Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.drupal.org/docs/develop/creating-modules/adding-assets-css-js-to-a-drupal-module-via-librariesyml&quot;&gt;Drupal Libraries API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://architecture.lullabot.com/adr/20251219-self-host-third-party-static-assets&quot;&gt;Self-host Third-Party Static Assets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://architecture.lullabot.com/adr/20231027-javascript-loading-defaults&quot;&gt;Load JavaScript as external resource with defer attribute&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.drupal.org/docs/develop/theming-drupal/using-single-directory-components/about-single-directory-components#s-what-are-the-benefits-of-using-single-directory-components&quot;&gt;SDC automatic library creation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Always provide editors control over image style cropping</title>
    <link href="https://architecture.lullabot.com/adr/20260703-provide-editors-image-crop-control/" />
    <updated>2026-07-03T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260703-provide-editors-image-crop-control/</id>
    <summary type="html">Manual user intervention can help prevent automated cropping from eliminating the most important parts of a photo.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="contrib-modules" scheme="https://architecture.lullabot.com/topics/" />
    <category term="editorial-experience" scheme="https://architecture.lullabot.com/topics/" />
    <category term="media" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;When using image styles that apply cropping, configure a method for editors to designate the most important area of each image. Do not rely on automated cropping without editorial crop control.&lt;/p&gt;
&lt;p&gt;Use &lt;a href=&quot;https://www.drupal.org/project/focal_point&quot;&gt;Focal Point&lt;/a&gt; as the default solution. If a project has requirements that Focal Point cannot satisfy, like independent crop regions per image style at different aspect ratios, use &lt;a href=&quot;https://www.drupal.org/project/image_widget_crop&quot;&gt;Image Widget Crop&lt;/a&gt; with the &lt;code&gt;crop&lt;/code&gt; and &lt;code&gt;ratio_crop&lt;/code&gt; modules instead, and document that choice in a project-level ADR.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Editors will need guidance on why setting a focal point matters and how to use the widget when uploading or editing images.&lt;/li&gt;
&lt;li&gt;Images that predate this configuration may lack crop data. When a cropping image style is added to an existing field, those images should be reviewed and updated.&lt;/li&gt;
&lt;li&gt;Cropped image styles will produce more predictable results across the range of display contexts where an image is used.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Automate checking for uncommitted files</title>
    <link href="https://architecture.lullabot.com/adr/20260626-automate-checking-for-uncommitted-files/" />
    <updated>2026-06-26T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260626-automate-checking-for-uncommitted-files/</id>
    <summary type="html">Uncommitted files resulting from builds can cause issues during deployments.</summary>
    <category term="git" scheme="https://architecture.lullabot.com/topics/" />
    <category term="ci" scheme="https://architecture.lullabot.com/topics/" />
    <category term="devops" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Add automation to verify there are no uncommitted files tracked in git.&lt;/p&gt;
&lt;h2 id=&quot;implementations&quot; tabindex=&quot;-1&quot;&gt;Implementations&lt;/h2&gt;
&lt;p&gt;This test can be implemented several ways.&lt;/p&gt;
&lt;h3 id=&quot;drainpipe&quot; tabindex=&quot;-1&quot;&gt;Drainpipe&lt;/h3&gt;
&lt;p&gt;If your project already uses
&lt;a href=&quot;https://github.com/Lullabot/drainpipe&quot;&gt;Drainpipe&lt;/a&gt;, this test is already
included in the &lt;code&gt;task test:static&lt;/code&gt; and &lt;code&gt;task test:functional&lt;/code&gt; jobs. It
is also included in the preconfigured Github Actions job. If needed, the
test can be run independently: &lt;code&gt;task test:untracked&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&quot;task-runner&quot; tabindex=&quot;-1&quot;&gt;Task runner&lt;/h3&gt;
&lt;p&gt;If not using Drainpipe, but are using an automated task runner, such as
Github Actions or Bitbucket Pipelines, add the test there.&lt;/p&gt;
&lt;p&gt;If using &lt;a href=&quot;https://github.com/features/actions&quot;&gt;Github Actions&lt;/a&gt;, consider
&lt;a href=&quot;https://github.com/tj-actions/verify-changed-files&quot;&gt;verify-changed-files&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If using another task runner, either adapt the &lt;code&gt;verify-changed-files&lt;/code&gt;
project, or utilize the &lt;code&gt;pre-commit&lt;/code&gt; script, below.&lt;/p&gt;
&lt;h3 id=&quot;git-pre-commit-hook&quot; tabindex=&quot;-1&quot;&gt;Git pre-commit hook&lt;/h3&gt;
&lt;p&gt;If the project does not have access to Drainpipe or a task runner, or
does not want the overhead of their inclusion, use a git &lt;a href=&quot;https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks&quot;&gt;pre-commit
hook&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The following shell script is sufficient to test.&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token shebang important&quot;&gt;#!/bin/sh&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-z&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; status &lt;span class=&quot;token parameter variable&quot;&gt;--porcelain&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
  &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Working directory clean&quot;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
  &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Uncommitted changes present&quot;&lt;/span&gt;
  &lt;span class=&quot;token builtin class-name&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Deployments will not have errors related to uncommitted files&lt;/li&gt;
&lt;li&gt;Devops will need to setup uncommitted file checks for each project&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Use data-drupal-selector to target form elements in JavaScript</title>
    <link href="https://architecture.lullabot.com/adr/20260610-use-data-drupal-selector-in-javascript/" />
    <updated>2026-06-10T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260610-use-data-drupal-selector-in-javascript/</id>
    <summary type="html">Classes and IDs are unstable JavaScript targets in Drupal, while data-drupal-selector is a stable hook provided by the Form API.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="javascript" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;When JavaScript needs to target an element rendered through Drupal&#39;s Form API, select it by its &lt;code&gt;data-drupal-selector&lt;/code&gt; attribute instead of a class or an ID.&lt;/p&gt;
&lt;p&gt;Drupal adds &lt;code&gt;data-drupal-selector&lt;/code&gt; to every form and to every form element that has an ID. The attribute exists to provide a selector usable by JavaScript, because the ID cannot be relied on. In practice this covers entity forms, configuration forms, views exposed filters, the search block, and the forms inside Media Library and Layout Builder dialogs.&lt;/p&gt;
&lt;p&gt;Classes and IDs fail as JavaScript hooks for different reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;IDs must be unique, so Drupal appends suffixes such as &lt;code&gt;edit-title--2&lt;/code&gt; when a form or element renders more than once on a page.&lt;/li&gt;
&lt;li&gt;On AJAX requests, Drupal appends random suffixes to ids such as &lt;code&gt;edit-title--aB3-cD_eFgh&lt;/code&gt; to ensure uniqueness.&lt;/li&gt;
&lt;li&gt;Classes are owned by the theme layer, and switching the theme, or functionality meant to work across a user facing theme and an admin facing theme, can break your class-based selectors.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Avoid: breaks when the ID gets a suffix on rebuild.&lt;/span&gt;
document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;#edit-title&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Avoid: breaks if the active theme overrides the relevant template / pre-processor and changes the class&lt;/span&gt;
document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.form-item-title&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Prefer: stable across rebuilds, themes, and duplicate renders.&lt;/span&gt;
document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;[data-drupal-selector=&quot;edit-title&quot;]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Accessibility wiring such as &lt;code&gt;label[for]&lt;/code&gt; and &lt;code&gt;aria-describedby&lt;/code&gt; must keep referencing IDs. That is referencing an ID, not selecting by it in JavaScript.&lt;/li&gt;
&lt;li&gt;When third-party libraries or contrib modules only expose class-based hooks, classes can be used as selectors for these elements.&lt;/li&gt;
&lt;li&gt;Older Drupal convention used &lt;code&gt;js-*&lt;/code&gt; prefixed classes. When &lt;code&gt;data-drupal-selector&lt;/code&gt; attributes are not available, but &lt;code&gt;js-*&lt;/code&gt; classes are available, prefer &lt;code&gt;js-*&lt;/code&gt; classes before presentational classes.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;JavaScript keeps working when a form renders more than once on the same page. This removes a common source of regressions in views exposed filters and dialog-based UIs.&lt;/li&gt;
&lt;li&gt;Selectors document their own intent. A &lt;code&gt;[data-drupal-selector]&lt;/code&gt; selector marks a functional dependency, while a class only describes presentation, making it clear which parts of the markup JavaScript relies on.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;additional-resources&quot; tabindex=&quot;-1&quot;&gt;Additional Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.drupal.org/node/2503277&quot;&gt;Change record: HTML IDs are now randomized for AJAX responses&lt;/a&gt;, the official guidance introducing &lt;code&gt;data-drupal-selector&lt;/code&gt; as the replacement for ID selectors in JavaScript.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.drupal.org/node/3357756&quot;&gt;Change record: Changes to generation of data-drupal-selector attribute for form elements&lt;/a&gt;, which describes how the attribute is generated and how to set it explicitly.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Respect prefers-reduced-motion for all animations and transitions</title>
    <link href="https://architecture.lullabot.com/adr/20260522-reduced-motion-handling/" />
    <updated>2026-05-22T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260522-reduced-motion-handling/</id>
    <summary type="html">Users with vestibular disorders rely on the prefers-reduced-motion media query to disable or reduce motion that can cause discomfort.</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="css" scheme="https://architecture.lullabot.com/topics/" />
    <category term="javascript" scheme="https://architecture.lullabot.com/topics/" />
    <category term="accessibility" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will respect &lt;code&gt;prefers-reduced-motion: reduce&lt;/code&gt; for all animations, transitions, smooth scrolling, and motion-driven UI. This applies to custom code as well as third-party plugins and legacy code, which must be overridden when they do not honor the preference natively.&lt;/p&gt;
&lt;h3 id=&quot;implementation&quot; tabindex=&quot;-1&quot;&gt;Implementation&lt;/h3&gt;
&lt;p&gt;Custom CSS animations and transitions must be scoped inside a &lt;code&gt;prefers-reduced-motion: no-preference&lt;/code&gt; media query, so motion only runs when the user has not expressed a preference for reduced motion:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;prefers-reduced-motion&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; no-preference&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token selector&quot;&gt;.card&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; transform 0.3s ease&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;JavaScript-driven animations must check the same media query before running, per &lt;a href=&quot;https://www.w3.org/WAI/WCAG22/Techniques/client-side-script/SCR40&quot;&gt;WCAG SCR40&lt;/a&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; animationOkay &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;matchMedia&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;(prefers-reduced-motion: no-preference)&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;matches&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;animationOkay&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;/* The user has not expressed a preference for reduced motion — run JavaScript-based animation */&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For third-party plugins or legacy code that does not honor the preference natively (for example, carousels and sliders with auto-play), enforce reduced motion by overriding the offending CSS or by using the plugin&#39;s JavaScript API to disable motion when &lt;code&gt;prefers-reduced-motion: reduce&lt;/code&gt; is active.&lt;/p&gt;
&lt;h2 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Animation is allowed when the activity can&#39;t be accomplished without the motion, such as map panning where the animation conveys spatial context.&lt;/li&gt;
&lt;li&gt;Motion animation does not include changes of color, blurring, or opacity which do not change the perceived size, shape, or position of the element.&lt;/li&gt;
&lt;li&gt;Animations and transitions with inperceptibly short durations may be used globally if &lt;code&gt;transitionEnd&lt;/code&gt; or &lt;code&gt;animationEnd&lt;/code&gt; events are used for asynchronous functionality.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;All CSS transitions and animations are disabled or instant for users who prefer reduced motion&lt;/li&gt;
&lt;li&gt;Sliders and carousels stop auto-advancing&lt;/li&gt;
&lt;li&gt;Video and other media doesn&#39;t auto play.&lt;/li&gt;
&lt;li&gt;Third-party plugins, legacy code, and JS-driven motion must also respect the preference where possible.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;additional-resources&quot; tabindex=&quot;-1&quot;&gt;Additional Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion&quot;&gt;MDN: prefers-reduced-motion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.w3.org/WAI/WCAG21/Understanding/animation-from-interactions.html&quot;&gt;WCAG 2.1 SC 2.3.3 Animation from Interactions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.w3.org/WAI/WCAG22/Techniques/client-side-script/SCR40&quot;&gt;WCAG SCR40: Using the CSS prefers-reduced-motion query in JavaScript&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Use the feature branch git workflow</title>
    <link href="https://architecture.lullabot.com/adr/20260522-use-git-feature-branch-workflow/" />
    <updated>2026-05-22T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260522-use-git-feature-branch-workflow/</id>
    <summary type="html">Establishing a standard git workflow improves velocity and consistency of delivery.</summary>
    <category term="git" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use the &lt;a href=&quot;https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow&quot;&gt;feature branch git workflow&lt;/a&gt;. Do not use git-flow or other more complicated branching systems.&lt;/p&gt;
&lt;h2 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h2&gt;
&lt;p&gt;Another git workflow can be used if the project already has a well established system that works well.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Projects will have a consistent git workflow&lt;/li&gt;
&lt;li&gt;The git workflow will be quick and easy for developers to understand&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;additional-resources&quot; tabindex=&quot;-1&quot;&gt;Additional Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://about.gitlab.com/topics/version-control/what-is-git-workflow/#feature-branching-git-workflow&quot;&gt;Feature branching Git workflow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://architecture.lullabot.com/adr/20251125-main-deployable/&quot;&gt;The main branch of a project should always be ready to deploy to production&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Always pin GitHub Actions to a commit hash</title>
    <link href="https://architecture.lullabot.com/adr/20260505-pin-github-actions-to-hash/" />
    <updated>2026-05-05T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260505-pin-github-actions-to-hash/</id>
    <summary type="html">GitHub Actions referenced by a mutable tag or branch can be silently replaced with malicious code, exposing CI/CD secrets across every repository that uses them.</summary>
    <category term="ci" scheme="https://architecture.lullabot.com/topics/" />
    <category term="security" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;All GitHub Actions must be pinned to a full commit SHA rather than a tag or branch name.&lt;/p&gt;
&lt;pre class=&quot;language-yaml&quot;&gt;&lt;code class=&quot;language-yaml&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Bad - mutable, can be silently replaced&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;token key atrule&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; actions/checkout@v4

&lt;span class=&quot;token comment&quot;&gt;# Good - immutable, tied to a specific commit&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;token key atrule&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac &lt;span class=&quot;token comment&quot;&gt;# v4.0.0&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Include the corresponding version tag as a comment so the pinned commit remains human-readable and can be updated intentionally.&lt;/p&gt;
&lt;h2 id=&quot;enforcement&quot; tabindex=&quot;-1&quot;&gt;Enforcement&lt;/h2&gt;
&lt;h3 id=&quot;at-the-organization-level&quot; tabindex=&quot;-1&quot;&gt;At the organization level&lt;/h3&gt;
&lt;p&gt;GitHub now supports &lt;a href=&quot;https://github.blog/changelog/2025-08-15-github-actions-policy-now-supports-blocking-and-sha-pinning-actions/&quot;&gt;enforcing SHA pinning at the organization level&lt;/a&gt;. Enable this policy for GitHub organizations when possible. This causes any workflow using a non-pinned action to fail outright.&lt;/p&gt;
&lt;h3 id=&quot;at-the-project-level&quot; tabindex=&quot;-1&quot;&gt;At the project level&lt;/h3&gt;
&lt;p&gt;Projects should pin all actions regardless of whether the organization policy is in place. Use &lt;a href=&quot;https://architecture.lullabot.com/adr/20251120-use-renovate&quot;&gt;Renovate&lt;/a&gt; to keep pinned hashes up to date automatically by adding the &lt;code&gt;helpers:pinGitHubActionDigests&lt;/code&gt; preset to the &lt;code&gt;extends&lt;/code&gt; array:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;&quot;extends&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;helpers:pinGitHubActionDigests&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Renovate will update the commit SHA whenever the referenced tag moves, keeping the pin current without manual effort.&lt;/p&gt;
&lt;h2 id=&quot;background&quot; tabindex=&quot;-1&quot;&gt;Background&lt;/h2&gt;
&lt;p&gt;In March 2025, a &lt;a href=&quot;https://www.schneier.com/blog/archives/2025/03/critical-github-attack.html&quot;&gt;cascading supply chain attack&lt;/a&gt; compromised the widely used &lt;code&gt;tj-actions/changed-files&lt;/code&gt; action by pushing malicious code to an existing tag. Any repository referencing the action by tag automatically ran the malicious code and exposed CI/CD secrets. Pinning to a commit SHA prevents this class of attack entirely: a tag can be moved to point at new code, but a SHA is immutable.&lt;/p&gt;
&lt;h2 id=&quot;additional-resources&quot; tabindex=&quot;-1&quot;&gt;Additional resources&lt;/h2&gt;
&lt;p&gt;While not mandatory, projects can use the &lt;a href=&quot;https://github.com/zizmorcore/zizmor&quot;&gt;Zizmor&lt;/a&gt; tool to perform static
checks on GitHub Actions, ensuring that all actions are pinned to a specific commit SHA.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;All existing workflows should be audited and updated to use commit SHA pins. New workflows must follow this pattern from the start.&lt;/p&gt;
&lt;p&gt;Pinned SHAs require active maintenance to stay current. Using &lt;a href=&quot;https://architecture.lullabot.com/adr/20251120-use-renovate&quot;&gt;Renovate&lt;/a&gt; with the &lt;code&gt;helpers:pinGitHubActionDigests&lt;/code&gt; preset automates this, making the maintenance overhead negligible.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use Stylelint</title>
    <link href="https://architecture.lullabot.com/adr/20260421-use-stylelint/" />
    <updated>2026-04-21T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260421-use-stylelint/</id>
    <summary type="html">Using Stylelint helps prevent errors and keeps code in a consistent format.</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="css" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use &lt;a href=&quot;https://stylelint.io/&quot;&gt;Stylelint&lt;/a&gt; plugin to lint all non-vendored styles. Use the &lt;a href=&quot;https://www.npmjs.com/package/stylelint-config-standard&quot;&gt;&lt;code&gt;stylelint-config-standard&lt;/code&gt;&lt;/a&gt; package for CSS, or the &lt;a href=&quot;https://www.npmjs.com/package/stylelint-config-standard-scss&quot;&gt;&lt;code&gt;stylelint-config-standard-scss&lt;/code&gt;&lt;/a&gt; for SASS. Add minimal rule overrides as necessary to adhere to project guidelines.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;CSS code will have less errors&lt;/li&gt;
&lt;li&gt;CSS code will be more consistently formatted&lt;/li&gt;
&lt;li&gt;Developers will have to adhere to the stylelint&#39;s code constraints&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Use Tagify for entity autocomplete widgets in Drupal</title>
    <link href="https://architecture.lullabot.com/adr/20260414-use-tagify/" />
    <updated>2026-04-14T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260414-use-tagify/</id>
    <summary type="html">Drupal&#39;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.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="contrib-modules" scheme="https://architecture.lullabot.com/topics/" />
    <category term="editorial-experience" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use the &lt;a href=&quot;https://www.drupal.org/project/tagify&quot;&gt;Tagify&lt;/a&gt; contributed module on all new Drupal projects, and configure it as the default widget for entity reference fields site-wide.&lt;/p&gt;
&lt;p&gt;Tagify has been used successfully across several Lullabot projects and ships as the default entity reference widget in Drupal CMS, making it a well-validated choice.&lt;/p&gt;
&lt;h3 id=&quot;configure-tagify-as-the-default-widget-for-entity-reference-fields&quot; tabindex=&quot;-1&quot;&gt;Configure Tagify as the default widget for entity reference fields&lt;/h3&gt;
&lt;p&gt;The Tagify module offers the possibility to configure it as the default widget for Entity Reference fields across the site, which will help adopting it for every new field.&lt;/p&gt;
&lt;p&gt;This setting can be set from &lt;code&gt;/admin/config/tagify/settings&lt;/code&gt;, enabling hte checkbox there and exporting the config.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;All new entity reference fields will automatically use Tagify&#39;s autocomplete widget, providing a consistent and modern editorial experience across the site.&lt;/p&gt;
&lt;p&gt;Existing projects do not need to migrate existing widgets. Switching widgets on a live site is a UX change and may require code adaptation if custom code interacts with widget-stored values.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use composer audit in automated checks for known security vulnerabilities</title>
    <link href="https://architecture.lullabot.com/adr/20260410-composer-audit/" />
    <updated>2026-04-10T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260410-composer-audit/</id>
    <summary type="html">Third-party dependencies can introduce known security vulnerabilities at any time, so projects need an automated mechanism to detect them early.</summary>
    <category term="composer" scheme="https://architecture.lullabot.com/topics/" />
    <category term="security" scheme="https://architecture.lullabot.com/topics/" />
    <category term="ci" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Run &lt;a href=&quot;https://php.watch/articles/composer-audit&quot;&gt;&lt;code&gt;composer audit&lt;/code&gt;&lt;/a&gt; as part of every project&#39;s CI pipeline. The command checks all installed Composer
packages against the &lt;a href=&quot;https://packagist.org/apidoc#list-security-advisories&quot;&gt;Packagist Security Vulnerability API&lt;/a&gt; and exits with a non-zero status when
any package version matches a known advisory.&lt;/p&gt;
&lt;h3 id=&quot;running-the-check&quot; tabindex=&quot;-1&quot;&gt;Running the check&lt;/h3&gt;
&lt;p&gt;Projects using &lt;a href=&quot;https://github.com/Lullabot/drainpipe&quot;&gt;Drainpipe&lt;/a&gt; already have this covered. The &lt;code&gt;task test:security&lt;/code&gt; command (and its
&lt;a href=&quot;https://github.com/Lullabot/drainpipe?tab=readme-ov-file#security&quot;&gt;GitHub Actions&lt;/a&gt; /
&lt;a href=&quot;https://github.com/Lullabot/drainpipe?tab=readme-ov-file#security-1&quot;&gt;GitLab CI&lt;/a&gt; counterparts) runs &lt;code&gt;composer audit&lt;/code&gt; under the hood, together with
additional Drupal-specific security checks.&lt;/p&gt;
&lt;p&gt;To enable the Security workflow in GitHub Actions, add the following to &lt;code&gt;composer.json&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token property&quot;&gt;&quot;extra&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;&quot;drainpipe&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token property&quot;&gt;&quot;github&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Security&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For projects not using Drainpipe, add &lt;code&gt;composer audit&lt;/code&gt; directly to the CI configuration:&lt;/p&gt;
&lt;pre class=&quot;language-console&quot;&gt;&lt;code class=&quot;language-console&quot;&gt;composer audit&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;ignoring-specific-advisories&quot; tabindex=&quot;-1&quot;&gt;Ignoring specific advisories&lt;/h3&gt;
&lt;p&gt;Occasionally an advisory cannot be resolved immediately — for example when the vulnerable package is pinned by Drupal core. To prevent these from blocking
the pipeline, configure exceptions in &lt;code&gt;composer.json&lt;/code&gt; with a reason for each:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;&quot;config&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token property&quot;&gt;&quot;audit&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token property&quot;&gt;&quot;ignore&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;token property&quot;&gt;&quot;CVE-2024-XXXXX&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Pinned by Drupal core; upgrade blocked until next minor.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;token property&quot;&gt;&quot;GHSA-xxxx-yyyy&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;The affected component is not in use.&quot;&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;See the &lt;a href=&quot;https://getcomposer.org/doc/06-config.md#ignore&quot;&gt;Composer audit configuration docs&lt;/a&gt; for the full set of options, including severity filtering and
scoping ignores to audit reports or version blocking only.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Security vulnerabilities in dependencies will be surfaced automatically on every pull request and deploy pipeline, reducing the window between disclosure
and awareness.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Only allow developers and site administrators access to the default Drupal files listing</title>
    <link href="https://architecture.lullabot.com/adr/20260320-files-listing-access/" />
    <updated>2026-03-20T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260320-files-listing-access/</id>
    <summary type="html">Drupal&#39;s built-in files listing at &lt;code&gt;/admin/content/files&lt;/code&gt; is a technical tool that has caused editorial confusion and accidental data loss.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="access-control" scheme="https://architecture.lullabot.com/topics/" />
    <category term="media" scheme="https://architecture.lullabot.com/topics/" />
    <category term="editorial-experience" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Restrict access to the default Drupal files listing (&lt;code&gt;/admin/content/files&lt;/code&gt;) to developers and users with administrator-level permissions. It is primarily a debugging tool, not an editorial interface.&lt;/p&gt;
&lt;h2 id=&quot;background&quot; tabindex=&quot;-1&quot;&gt;Background&lt;/h2&gt;
&lt;p&gt;On projects using the Media module — which is the standard on all new projects — files are always managed through media entities. Exposing the raw files listing to editors introduces several problems:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Inaccurate usage counts.&lt;/strong&gt; The usage counts shown in the files listing are unreliable and have known open issues (e.g. &lt;a href=&quot;https://www.drupal.org/project/drupal/issues/2821423&quot;&gt;#2821423&lt;/a&gt; and related). Editors acting on this data may draw incorrect conclusions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Accidental deletion.&lt;/strong&gt; Editors have deleted files directly from this listing, bypassing the media layer and breaking media entities that still reference those files.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MIME type confusion.&lt;/strong&gt; The raw MIME types displayed (e.g. &lt;code&gt;image/jpeg&lt;/code&gt;, &lt;code&gt;application/pdf&lt;/code&gt;) are not meaningful to editors and cause unnecessary confusion.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Editors will manage files exclusively through the Media library, which provides an interface designed for editorial use and reflects the actual state of managed content.&lt;/p&gt;
&lt;h2 id=&quot;exception&quot; tabindex=&quot;-1&quot;&gt;Exception&lt;/h2&gt;
&lt;p&gt;On sites inherited without the Media module, do not rely on the built-in files view. Instead, create a purpose-built view with editorial concerns in mind: hide MIME types, surface meaningful labels, and omit unreliable usage counts. The specific implementation will vary based on the site&#39;s legacy or custom requirements.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use PHPStan for PHP code static analysis at level 6</title>
    <link href="https://architecture.lullabot.com/adr/20260320-use-phpstan/" />
    <updated>2026-03-20T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260320-use-phpstan/</id>
    <summary type="html">Static analysis catches type errors, logic bugs, and unsafe code paths without running the application, improving code quality at low cost.</summary>
    <category term="php" scheme="https://architecture.lullabot.com/topics/" />
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="ci" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use &lt;a href=&quot;https://github.com/phpstan/phpstan&quot;&gt;PHPStan&lt;/a&gt; for static analysis of PHP code on all projects. Integrate it into CI and pre-commit hooks so
violations on new code are caught before merge.&lt;/p&gt;
&lt;p&gt;All new code we write must be &lt;a href=&quot;https://phpstan.org/user-guide/rule-levels&quot;&gt;PHPStan level 6&lt;/a&gt; compliant. Existing code in inherited or legacy codebases does
not need to be fixed up-front.&lt;/p&gt;
&lt;h3 id=&quot;configuration&quot; tabindex=&quot;-1&quot;&gt;Configuration&lt;/h3&gt;
&lt;p&gt;Add a &lt;code&gt;phpstan.neon&lt;/code&gt; file at the project root:&lt;/p&gt;
&lt;pre class=&quot;language-yaml&quot;&gt;&lt;code class=&quot;language-yaml&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Configuration file for PHPStan static code checking, see https://phpstan.org .&lt;/span&gt;
&lt;span class=&quot;token key atrule&quot;&gt;includes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; phar&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;//phpstan.phar/conf/bleedingEdge.neon
  &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; phpstan&lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt;baseline.neon

&lt;span class=&quot;token key atrule&quot;&gt;parameters&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;

  &lt;span class=&quot;token key atrule&quot;&gt;level&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;6&lt;/span&gt;

  &lt;span class=&quot;token key atrule&quot;&gt;treatPhpDocTypesAsCertain&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean important&quot;&gt;false&lt;/span&gt;

  &lt;span class=&quot;token key atrule&quot;&gt;ignoreErrors&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;# new static() is a best practice in Drupal, so we cannot fix that.&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;#^Unsafe usage of new static#&quot;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;token key atrule&quot;&gt;identifier&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; missingType.iterableValue &lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;baseline-for-existing-codebases&quot; tabindex=&quot;-1&quot;&gt;Baseline for existing codebases&lt;/h3&gt;
&lt;p&gt;Projects with a large existing codebase can use &lt;a href=&quot;https://phpstan.org/user-guide/baseline&quot;&gt;PHPStan&#39;s baseline feature&lt;/a&gt; to ignore all pre-existing violations
and enforce level 6 only on new code going forward:&lt;/p&gt;
&lt;pre class=&quot;language-console&quot;&gt;&lt;code class=&quot;language-console&quot;&gt;vendor/bin/phpstan analyse --generate-baseline&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This generates a &lt;code&gt;phpstan-baseline.neon&lt;/code&gt; file that silences known violations. New and modified code will still be
checked at level 6. The baseline file should be committed to the repository and gradually reduced over time as legacy
violations are fixed.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Static analysis will catch type errors, incorrect method calls, and other classes of bugs before code reaches review or
production.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use &#39;drush deploy&#39; when building Drupal sites</title>
    <link href="https://architecture.lullabot.com/adr/20260313-drupal-build-steps/" />
    <updated>2026-03-13T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260313-drupal-build-steps/</id>
    <summary type="html">When updating Drupal code and configuration in a given environment, it&#39;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.</summary>
    <category term="drush" scheme="https://architecture.lullabot.com/topics/" />
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="deployments" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We standardize the build steps as the ones implemented by the &lt;code&gt;drush deploy&lt;/code&gt;
command.&lt;/p&gt;
&lt;p&gt;Sites are strongly encouraged to run &lt;code&gt;drush deploy&lt;/code&gt; directly as part of their
automation pipelines.&lt;/p&gt;
&lt;p&gt;Developers should write update hooks using these guidelines:&lt;/p&gt;
&lt;h3 id=&quot;hook_update_n()&quot; tabindex=&quot;-1&quot;&gt;&lt;a href=&quot;https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!module.api.php/function/hook_update_N&quot;&gt;&lt;code&gt;HOOK_update_N()&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Code that does not rely on any Drupal services, entity CRUD operations,
entity APIs, router system, etc, usually to perform direct database queries.
Check &lt;a href=&quot;https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!module.api.php/function/hook_update_N&quot;&gt;the documentation&lt;/a&gt;
for more details about what is safe to use in these hooks.&lt;/p&gt;
&lt;p&gt;These hooks are the first ones to be executed, before configuration is imported.&lt;/p&gt;
&lt;h3 id=&quot;hook_post_update_name()&quot; tabindex=&quot;-1&quot;&gt;&lt;a href=&quot;https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!module.api.php/function/hook_post_update_NAME&quot;&gt;&lt;code&gt;HOOK_post_update_NAME()&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;These are called when Drupal is fully bootstrapped and all Drupal APIs are
safe to use. This is usually the place to write code that needs to alter content
but doesn&#39;t require the new configuration in place, since these hooks will be
executed before configuration is imported.&lt;/p&gt;
&lt;h3 id=&quot;hook_deploy_name()&quot; tabindex=&quot;-1&quot;&gt;&lt;a href=&quot;https://github.com/drush-ops/drush/tree/HEAD/drush.api.php&quot;&gt;&lt;code&gt;HOOK_deploy_NAME()&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;These are equivalent to &lt;code&gt;HOOK_post_update_NAME()&lt;/code&gt; in terms of APIs available,
the only difference being that this is executed &lt;em&gt;after&lt;/em&gt; configuration is
imported.&lt;/p&gt;
&lt;h2 id=&quot;customizing-the-build-steps&quot; tabindex=&quot;-1&quot;&gt;Customizing the build steps&lt;/h2&gt;
&lt;p&gt;Under certain circumstances, sites may need to adjust the steps performed during
Drupal builds. For example, some sites might need to import configuration twice
due to platform or site architecture constraints. In these cases, sites are
encouraged to replace the implementation of &lt;code&gt;drush deploy&lt;/code&gt; with their own set
of steps.&lt;/p&gt;
&lt;p&gt;Here is an example snippet that demonstrates an implementation that swaps
&lt;code&gt;drush deploy&lt;/code&gt; with a custom set of steps, performing config import twice:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;// FILE: [project root]/drush/Commands/DeployReplaceCommands.php

&lt;span class=&quot;token php language-php&quot;&gt;&lt;span class=&quot;token delimiter important&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;declare&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;strict_types&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Drush&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Commands&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Consolidation&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;AnnotatedCommand&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Hooks&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;HookManager&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Consolidation&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;SiteAlias&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;SiteAliasManagerAwareTrait&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Drush&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Attributes&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;CLI&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Drush&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Boot&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;DrupalBootLevels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Drush&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Commands&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;config&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;ConfigImportCommands&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Drush&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Commands&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;core&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;CacheRebuildCommands&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Drush&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Commands&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;core&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;DeployCommands&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Drush&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Commands&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;core&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;DeployHookCommands&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Drush&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Commands&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;core&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;UpdateDBCommands&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Drush&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Drush&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Drush&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;SiteAlias&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;SiteAliasManagerAwareInterface&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/**
 * Replaces the core deploy command with a custom implementation.
 *
 * This lives as a site-level command file (drush/Commands/) rather than in a
 * Drupal module because the original deploy command uses bootstrap level NONE.
 * Module-provided hooks are only registered during Drupal bootstrap, which
 * never happens for NONE commands — so a module-level replace-command hook
 * would never fire.
 */&lt;/span&gt;
&lt;span class=&quot;token attribute&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;#[&lt;/span&gt;&lt;span class=&quot;token attribute-content&quot;&gt;&lt;span class=&quot;token attribute-class-name class-name class-name-fully-qualified&quot;&gt;CLI&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Bootstrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token attribute-class-name class-name&quot;&gt;DrupalBootLevels&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;NONE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name-definition class-name&quot;&gt;DeployReplaceCommands&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;DrushCommands&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;SiteAliasManagerAwareInterface&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;SiteAliasManagerAwareTrait&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;token attribute&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;#[&lt;/span&gt;&lt;span class=&quot;token attribute-content&quot;&gt;&lt;span class=&quot;token attribute-class-name class-name class-name-fully-qualified&quot;&gt;CLI&lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;Hook&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token attribute-class-name class-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token attribute-class-name class-name&quot;&gt;HookManager&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;REPLACE_COMMAND_HOOK&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token attribute-class-name class-name&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token attribute-class-name class-name&quot;&gt;DeployCommands&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;DEPLOY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function-definition function&quot;&gt;replaceDeploy&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword return-type&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// This is a copy of &#92;Drush&#92;Commands&#92;core&#92;DeployCommands::deploy() but&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// performing two config imports instead of one.&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$self&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;siteAliasManager&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getSelf&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$redispatch_options&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token class-name static-context&quot;&gt;Drush&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;redispatchOptions&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$manager&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;processManager&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token variable&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;notice&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Database updates start.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$manager&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;drush&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$self&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name static-context&quot;&gt;UpdateDBCommands&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;UPDATEDB&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$redispatch_options&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mustRun&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;showRealtime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token variable&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;success&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;First config import start.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$manager&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;drush&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$self&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name static-context&quot;&gt;ConfigImportCommands&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;IMPORT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$redispatch_options&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mustRun&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;showRealtime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token variable&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;success&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Second config import start.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$manager&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;drush&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$self&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name static-context&quot;&gt;ConfigImportCommands&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;IMPORT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$redispatch_options&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mustRun&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;showRealtime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token variable&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;success&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Cache rebuild start.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$manager&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;drush&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$self&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name static-context&quot;&gt;CacheRebuildCommands&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;REBUILD&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$redispatch_options&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mustRun&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;showRealtime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token variable&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;success&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Deploy hook start.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$manager&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;drush&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$self&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name static-context&quot;&gt;DeployHookCommands&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;HOOK&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$redispatch_options&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mustRun&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$process&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;showRealtime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Developers have a clear and consistent guide to use update hooks among
projects.&lt;/li&gt;
&lt;li&gt;Automation can be built to ensure these steps are executed consistently.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Use the term &quot;microcontent&quot; to describe embeddable content from the same website</title>
    <link href="https://architecture.lullabot.com/adr/20260313-microcontent-terminology/" />
    <updated>2026-03-13T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260313-microcontent-terminology/</id>
    <summary type="html">Teams have used inconsistent terminology — including &amp;quot;micro-content&amp;quot;, &amp;quot;component&amp;quot;, &amp;quot;embeds&amp;quot;, and &amp;quot;inline content&amp;quot; — to describe content that is embedded within pages but never exists independently.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="content-modeling" scheme="https://architecture.lullabot.com/topics/" />
    <category term="editorial-experience" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use the term &lt;strong&gt;microcontent&lt;/strong&gt; (no hyphen) to describe content entities from the same site that are embedded within other pages, do not have their own URL, and are not independently indexed by search engines.&lt;/p&gt;
&lt;p&gt;When possible, prefer more specific language (e.g., &amp;quot;embedded video&amp;quot;, &amp;quot;embedded call-to-action&amp;quot;), but &amp;quot;microcontent&amp;quot; is the accepted umbrella term when a category name is needed.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Use &amp;quot;microcontent&amp;quot; consistently across project documentation, content models, and site UI labels. Avoid introducing the hyphenated spelling in new builds; if the Drupal UI surfaces &amp;quot;Micro-content&amp;quot; from a module, override the label.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use `access_unpublished` for password-protected pages</title>
    <link href="https://architecture.lullabot.com/adr/20260313-use-access-unpublished/" />
    <updated>2026-03-13T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20260313-use-access-unpublished/</id>
    <summary type="html">Some pages need to be accessible only to specific groups or individuals using a password or token, without requiring a full user account.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="contrib-modules" scheme="https://architecture.lullabot.com/topics/" />
    <category term="access-control" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use the &lt;a href=&quot;https://www.drupal.org/project/access_unpublished&quot;&gt;Access Unpublished&lt;/a&gt; module to grant temporary, token-based access to specific nodes. This covers use cases such as white papers behind a code, volunteer sign-up forms for a specific group, or draft content shared with reviewers before publication.&lt;/p&gt;
&lt;p&gt;Do not use &lt;a href=&quot;https://www.drupal.org/project/protected_pages&quot;&gt;Protected Pages&lt;/a&gt; or custom access control solutions for this purpose.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Access is granted via time-limited, per-node tokens that can be revoked at any time, without requiring the recipient to have a Drupal account. This keeps the solution simple and auditable.&lt;/p&gt;
&lt;p&gt;Token URLs should be treated as sensitive and distributed carefully, as anyone with the link gains access for the duration of the token&#39;s validity.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Self-host Third-Party Static Assets</title>
    <link href="https://architecture.lullabot.com/adr/20251219-self-host-third-party-static-assets/" />
    <updated>2025-12-19T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20251219-self-host-third-party-static-assets/</id>
    <summary type="html">Third-party hosted assets (e.g. web fonts, icon libraries) can lead to performance, privacy, and reliability issues. These include GDPR violations, extra DNS lookups, and outages outside the organization control.</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="performance" scheme="https://architecture.lullabot.com/topics/" />
    <category term="javascript" scheme="https://architecture.lullabot.com/topics/" />
    <category term="css" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Critical static assets such as fonts, icons, and front-end libraries will be self-hosted. These files will reside within the project codebase and be served from the same infrastructure as the website.&lt;/p&gt;
&lt;h3 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;When upstream providers require external embedding (e.g., maps, videos).&lt;/li&gt;
&lt;li&gt;When a commercial support contract exists for the CDN (e.g., Cloudflare with SLA).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Improves privacy and avoids third-party data sharing.&lt;/li&gt;
&lt;li&gt;Reduces performance overhead from extra DNS requests.&lt;/li&gt;
&lt;li&gt;Ensures asset availability during third-party outages.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;additional-considerations&quot; tabindex=&quot;-1&quot;&gt;Additional Considerations&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Use package managers (npm, Composer) and automated dependency tools (Renovate, Dependabot) to keep self-hosted assets current.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://architecture.lullabot.com/adr/20231027-javascript-loading-defaults&quot;&gt;Load JavaScript as external resource with defer attribute&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Layer elements deliberately with stacking contexts</title>
    <link href="https://architecture.lullabot.com/adr/20251210-create-deliberate-stacking-contexts/" />
    <updated>2025-12-10T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20251210-create-deliberate-stacking-contexts/</id>
    <summary type="html">Overlap elements predictably by creating new stacking contexts for &lt;code&gt;z-index&lt;/code&gt; values.</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="css" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;When creating UI patterns with overlapping layers, we will avoid ambiguity by creating new stacking contexts and using z-index values as low as possible.&lt;/p&gt;
&lt;h2 id=&quot;context&quot; tabindex=&quot;-1&quot;&gt;Context&lt;/h2&gt;
&lt;p&gt;Uncoordinated use of &lt;code&gt;z-index&lt;/code&gt; and accidental stacking context creation can cause unpredictable UI layering and maintenance challenges. Our team needs a predictable, maintainable approach to visual stacking.&lt;/p&gt;
&lt;p&gt;When styling layouts and components, occasionally the need arises to layer an element above (or below) another one using the CSS &lt;code&gt;z-index&lt;/code&gt; property. This property orders relatively and absolutely positioned elements along the axis that extends perpendicularly out of the display toward and away from the user. This value, however, only compares elements within the same stacking context. While some frameworks create design tokens for various z-index values (e.g. &lt;a href=&quot;https://www.drupal.org/docs/develop/theming-drupal/z-indexes-in-drupal-8&quot;&gt;Drupal&#39;s list of core z-indices&lt;/a&gt;), these values &lt;em&gt;cannot work globally&lt;/em&gt;. They are only able to layer elements within a single stacking context.&lt;/p&gt;
&lt;p&gt;Instead, our CSS will be authored to keep z-indices low, and to only increase values by ±1 as needed relative to its stacking context.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Controlled Layering: When elements are meant to be layered independently of other elements in the DOM, especially when there is a need to isolate the stacking behavior of certain components (e.g., modals, tooltips, or dropdowns).&lt;/li&gt;
&lt;li&gt;Prevention of Global Stacking Conflicts: To avoid unintended stacking of elements that share the same stacking context, we will apply a &lt;code&gt;z-index&lt;/code&gt; on elements where the stacking order should be confined to a specific subtree of the document.&lt;/li&gt;
&lt;li&gt;Improved Predictability: Creating new stacking contexts will help ensure the visual layering order is more predictable and easier to manage in complex layouts, where many components and elements may overlap.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;example&quot; tabindex=&quot;-1&quot;&gt;Example&lt;/h2&gt;
&lt;p&gt;Consider a common design aesthetic in which a site has a header element, containing the site&#39;s main navigation, which has dropdown items. The markup for the page may look something like this:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;header&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;nav&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- Dropdown menu --&gt;&lt;/span&gt;
      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;nav&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;header&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;main&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- Page Content --&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;main&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To create the dropdown layout, we set &lt;code&gt;position: relative;&lt;/code&gt; on the top-level menu items and &lt;code&gt;position: absolute;&lt;/code&gt; on the container of our second-level items. By default, elements display statically with an automatic &lt;code&gt;z-index&lt;/code&gt; that is equivalent to &lt;code&gt;0&lt;/code&gt;. If we cause elements to overlap using a negative margin, elements that appear later in the DOM will cover elements declared earlier. Since our dropdown lists appear earlier in the DOM, they will default to appearing &lt;em&gt;below&lt;/em&gt; the content in &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If we opt to use a global z-index system, we might decide to simply apply an arbitrarily-high &lt;code&gt;z-index&lt;/code&gt; value to our dropdown list. This will work fine for a while, but if a later feature adds another floating-type component (e.g. modals, tooltips, flyouts, dropbuttons, etc) then you&#39;ve got to manage how those elements mesh together in a global system. Then, another change comes in that creates a new stacking context and your global system has broken and needs work-arounds.&lt;/p&gt;
&lt;p&gt;If we instead opt to scope our z-index values to their compoents and nearby UI patterns, we can add the following CSS to our page layout:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;nav&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;z-index&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token selector&quot;&gt;main&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;z-index&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In doing so, we&#39;ve created two new stacking contexts: one for navigation and another for the main content. Since our &lt;code&gt;nav&lt;/code&gt; has the higher stacking context relative to &lt;code&gt;main&lt;/code&gt;, &lt;em&gt;all elements in &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; will always appear above all elements in &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt;&lt;/em&gt;. This specific example is not meant to be prescriptive - there will certainly be cases in which elements in main may need to appear above the navigation - but it illustrates the concept. We&#39;ve created a new stacking context for the navigation and raised it by a manageable value of &lt;code&gt;1&lt;/code&gt;, as well as creating a new context for the rest of the page with a manageable value of &lt;code&gt;0&lt;/code&gt;. In this way, we can see the sibling contexts and know that one was deliberately placed over the other.&lt;/p&gt;
&lt;h2 id=&quot;references&quot; tabindex=&quot;-1&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/z-index&quot;&gt;MDN: Understanding CSS z-index&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.lullabot.com/articles/understanding-debugging-stacking-contexts&quot;&gt;Understanding &amp;amp; Debugging Stacking Contexts (and the Z-Index)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>The main branch of a project should always be ready to deploy to production</title>
    <link href="https://architecture.lullabot.com/adr/20251125-main-deployable/" />
    <updated>2025-11-25T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20251125-main-deployable/</id>
    <summary type="html">Even with the best planning, unexpected bugs and security issues can require a fast deployment to production. By ensuring the main branch is always deployable, we minimize additional development work and QA in the case of an unplanned deployment.</summary>
    <category term="devops" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;main&lt;/code&gt; branch in a git repository will always be ready to deploy to production for sites that have launched.  We will not use long-lived branches such as a &lt;code&gt;dev&lt;/code&gt; or sprint branch as the day-to-day target for code changes.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Teams will be confident in knowing that a main branch is ready to deploy if an unplanned deployment is required, such as a critical but out of schedule Drupal security release.&lt;/p&gt;
&lt;p&gt;Unplanned deployments will be faster to complete, because only the specific new changes will need to be tested, and not a backlog of untested work.&lt;/p&gt;
&lt;p&gt;Testing will need to occur primarily on pull requests, and not on a single &lt;code&gt;qa&lt;/code&gt; branch or environment. Pull request preview platforms like &lt;a href=&quot;https://www.tugboatqa.com&quot;&gt;Tugboat&lt;/a&gt; will need to be configured for projects. This will ensure that &lt;code&gt;main&lt;/code&gt; is tested and ready to deploy.&lt;/p&gt;
&lt;p&gt;Some hosting platforms, like Pantheon, enforce a strict dev / test / prod workflow. For those platforms, we may need to work outside their default workflows. For example, with Pantheon teams may need to deploy &lt;code&gt;main&lt;/code&gt; to a multidev environment so only tags from main are deployed to dev, test, and production. This also allows development teams to continue to commit to &lt;code&gt;main&lt;/code&gt; during deployment windows, increasing efficiency.&lt;/p&gt;
&lt;h2 id=&quot;additional-resources&quot; tabindex=&quot;-1&quot;&gt;Additional Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://architecture.lullabot.com/adr/20260522-use-git-feature-branch-workflow/&quot;&gt;Use the feature branch git workflow&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Use Renovate for third-party dependency updates</title>
    <link href="https://architecture.lullabot.com/adr/20251120-use-renovate/" />
    <updated>2025-11-20T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20251120-use-renovate/</id>
    <summary type="html">Renovate supports automatic updates across a wide variety of ecosystems ensuring our projects are secure and up to date.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="devops" scheme="https://architecture.lullabot.com/topics/" />
    <category term="security" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Projects will use &lt;a href=&quot;https://docs.renovatebot.com&quot;&gt;Renovate&lt;/a&gt; to keep third-party dependencies up to date.&lt;/p&gt;
&lt;p&gt;Drupal projects will use the following as their initial configuration file:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;&quot;$schema&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://docs.renovatebot.com/renovate-schema.json&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;&quot;extends&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;config:recommended&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;group:drupal-core&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;group:symfony&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;:enableVulnerabilityAlerts&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;helpers:pinGitHubActionDigests&quot;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;&quot;composerIgnorePlatformReqs&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;php&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;ext-*&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;lib-*&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;&quot;lockFileMaintenance&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;&quot;enabled&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;&quot;rangeStrategy&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;bump&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;&quot;packageRules&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token property&quot;&gt;&quot;matchPackageNames&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;lullabot/drainpipe&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;lullabot/drainpipe-dev&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;token property&quot;&gt;&quot;groupName&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Drainpipe packages&quot;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;&quot;ignorePaths&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;**/node_modules/**&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;**/bower_components/**&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;**/vendor/**&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;**/examples/**&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;**/__tests__/**&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;**/tests/**&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;**/__fixtures__/**&quot;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Non-Drupal projects will use the following as their initial configuration:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;&quot;$schema&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://docs.renovatebot.com/renovate-schema.json&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;&quot;extends&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;config:base&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;:enableVulnerabilityAlerts&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;helpers:pinGitHubActionDigests&quot;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;&quot;lockFileMaintenance&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;&quot;enabled&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;&quot;rangeStrategy&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;bump&quot;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;In comparison to other tools like Pantheon Autopilot, a pull-request centric workflow with automated tests and peer review will ensure that updates meet quality guidelines and are safe to deploy to production.&lt;/p&gt;
&lt;p&gt;Major dependency upgrades, such as upgrading Drupal, will be easier because sites will already be fully up to date before starting an upgrade.&lt;/p&gt;
&lt;p&gt;On projects with adequate test coverage, teams may decide to automatically merge some updates, especially those only used for development purposes. Those teams will need to additionally set up &lt;a href=&quot;https://github.com/apps/renovate-approve&quot;&gt;Renovate Approve&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Some teams may be overwhelmed by the number of dependency updates created by Renovate. Those teams may need to use Renovate&#39;s configuration options to group updates together, or reduce the number of third-party dependencies used to a manageable number.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use SVG view box instead of width and height</title>
    <link href="https://architecture.lullabot.com/adr/20251008-use-svg-viewbox/" />
    <updated>2025-10-08T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20251008-use-svg-viewbox/</id>
    <summary type="html">Using viewBox improves maintainability.</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="performance" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Include the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/viewBox&quot;&gt;&lt;code&gt;viewBox&lt;/code&gt;&lt;/a&gt; property on &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; elements.&lt;/p&gt;
&lt;p&gt;Omit the &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; properties from &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; elements.&lt;/p&gt;
&lt;h3 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h3&gt;
&lt;p&gt;User uploaded SVGs are except from this standard.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;SVG elements will have a defined bounding canvas, which will make them easier to size. Maintenance will be easier, as all width and height information will be grouped in a single domain, CSS.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use human-readable names as exposed filter identifiers in Views</title>
    <link href="https://architecture.lullabot.com/adr/20250924-human-readable-views-filters/" />
    <updated>2025-09-24T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20250924-human-readable-views-filters/</id>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="editorial-experience" scheme="https://architecture.lullabot.com/topics/" />
    <category term="views" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;context-and-problem-statement&quot; tabindex=&quot;-1&quot;&gt;Context and Problem Statement&lt;/h2&gt;
&lt;p&gt;When using exposed filters in Views, they are usually given &lt;strong&gt;default filter identifiers based on the field name&lt;/strong&gt; (e.g., &lt;code&gt;field_topic_target_id&lt;/code&gt;). This can lead to &lt;strong&gt;lengthy and unreadable query strings&lt;/strong&gt; in public-facing URLs, such as &lt;code&gt;/my-view-path?field_topic_target_id=5&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;A significant issue arises when the underlying implementation of a filter changes, for example, by switching from Drupal core&#39;s taxonomy filter to a different plugin like &lt;code&gt;taxonomy_entity_index&lt;/code&gt; . This change &lt;strong&gt;can alter the filter identifier&lt;/strong&gt; (e.g., from &lt;code&gt;field_name_target_id&lt;/code&gt; to &lt;code&gt;taxonomy_entity_index_tid_depth&lt;/code&gt;), which &lt;strong&gt;breaks any pre-filtered URLs&lt;/strong&gt; that users may have saved as bookmarks. This highlights a need for a strategy to ensure exposed filter identifiers are &lt;strong&gt;consistent, maintainable, and user-friendly&lt;/strong&gt;, reducing the risk of broken links and improving the clarity of URLs.&lt;/p&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;When configuring Views filters that are exposed for &lt;strong&gt;non-administrative (public-facing) Views&lt;/strong&gt;, we will &lt;strong&gt;override the default filter identifier&lt;/strong&gt; to use a &lt;strong&gt;shorter, user-friendly, and semantically consistent name&lt;/strong&gt; .&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Examples:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Instead of using &lt;code&gt;field_topic_target_id&lt;/code&gt; as the filter identifier, we will use &lt;strong&gt;&lt;code&gt;topic&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;For a filter on &lt;code&gt;field_event_date&lt;/code&gt;, we will use &lt;strong&gt;&lt;code&gt;event_date&lt;/code&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;code&gt;date&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Reduced Broken Links:&lt;/strong&gt; Bookmarked URLs or external links that include Views filters will be &lt;strong&gt;more resilient to backend changes&lt;/strong&gt; in field names or filter plugin implementations. This helps prevent a poor user experience caused by broken links.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Improved User Experience:&lt;/strong&gt; Shorter, more descriptive, and consistent URLs are &lt;strong&gt;easier for users to understand, remember, and share&lt;/strong&gt; . This enhances the overall usability of the site.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Enforce Twig coding standards with automatic linting</title>
    <link href="https://architecture.lullabot.com/adr/20250922-use-twig-coding-standard/" />
    <updated>2025-09-22T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20250922-use-twig-coding-standard/</id>
    <summary type="html">Linters like twigcs keep code more consistent and readable</summary>
    <category term="twig" scheme="https://architecture.lullabot.com/topics/" />
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use the &lt;a href=&quot;https://twig.symfony.com/doc/3.x/coding_standards.html&quot;&gt;official Twig coding standards&lt;/a&gt; for all Twig files.&lt;/p&gt;
&lt;p&gt;Enforce these standards with &lt;a href=&quot;https://github.com/VincentLanglet/Twig-CS-Fixer&quot;&gt;Twig-CS-Fixer&lt;/a&gt;. For Drupal projects, add &lt;a href=&quot;https://github.com/lullabot/twig-cs-fixer-drupal&quot;&gt;Twig-CS-Fixer-Drupal&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Twig files are easier to read by more people by following widely accepted code conventions.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use ImageMagick with Drupal</title>
    <link href="https://architecture.lullabot.com/adr/20250409-use-imagemagick-with-drupal/" />
    <updated>2025-04-24T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20250409-use-imagemagick-with-drupal/</id>
    <summary type="html">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.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="images" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use the &lt;a href=&quot;https://www.drupal.org/project/imagemagick&quot;&gt;ImageMagick&lt;/a&gt; module as the default image processing library for Drupal projects.&lt;/p&gt;
&lt;p&gt;Historically, ImageMagick has been considered more capable than GD. While GD may be slightly faster for a large number of small images, this difference is usually negligible. For larger projects, defaulting to ImageMagick is preferred. Even smaller projects benefit, as they are more likely to hit out-of-memory errors from high-resolution uploads. &lt;a href=&quot;https://docs.pantheon.io/external-libraries#imagemagick&quot;&gt;Pantheon&lt;/a&gt; and &lt;a href=&quot;https://acquia.my.site.com/s/article/360005255734-Scoping-the-impact-of-image-processing&quot;&gt;Acquia&lt;/a&gt; both recommend ImageMagick.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;h3 id=&quot;enhanced-image-processing-and-resource-optimization&quot; tabindex=&quot;-1&quot;&gt;Enhanced Image Processing and Resource Optimization&lt;/h3&gt;
&lt;p&gt;ImageMagick offers broader image manipulation capabilities than GD and helps reduce memory-related issues, especially with large images.&lt;/p&gt;
&lt;h3 id=&quot;consistent-implementation-on-hosting-platforms&quot; tabindex=&quot;-1&quot;&gt;Consistent Implementation on Hosting Platforms&lt;/h3&gt;
&lt;p&gt;ImageMagick is readily available on platforms like Pantheon and DDEV. Enabling it on Tugboat requires adding a &lt;a href=&quot;https://docs.tugboatqa.com/starter-configs/tutorials/pantheon/&quot;&gt;few lines&lt;/a&gt; to the &lt;code&gt;.tugboat/config.yml&lt;/code&gt; file.&lt;/p&gt;
&lt;pre class=&quot;language-yaml&quot;&gt;&lt;code class=&quot;language-yaml&quot;&gt;    &lt;span class=&quot;token key atrule&quot;&gt;commands&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;token key atrule&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; apt&lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt;get update
        &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; apt&lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt;get install &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt;y imagemagick&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;module-dependency&quot; tabindex=&quot;-1&quot;&gt;Module Dependency&lt;/h3&gt;
&lt;p&gt;Using ImageMagick requires installing and enabling the &lt;a href=&quot;https://www.drupal.org/project/imagemagick&quot;&gt;ImageMagick Drupal module&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;configuration&quot; tabindex=&quot;-1&quot;&gt;Configuration&lt;/h3&gt;
&lt;p&gt;Configure the module according to the instructions in the &lt;a href=&quot;https://git.drupalcode.org/project/imagemagick/-/blob/4.0.x/README.md#configuration&quot;&gt;README&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h3&gt;
&lt;p&gt;While ImageMagick is the default, smaller projects—especially those hosted outside Acquia or Pantheon—may opt out if the added module and system dependency introduce unnecessary overhead.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Avoid using jQuery</title>
    <link href="https://architecture.lullabot.com/adr/20250416-avoid-using-jquery/" />
    <updated>2025-04-16T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20250416-avoid-using-jquery/</id>
    <summary type="html">jQuery is an unnecessary dependency for modern browsers.</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="javascript" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Avoid using jQuery. Use standard JavaScript alternatives instead.&lt;/p&gt;
&lt;h2 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h2&gt;
&lt;p&gt;If a required project dependency itself depends on jQuery, it is fine to include that dependency. If the only way to interface with that dependency’s API is through jQuery, then that is acceptable.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;JavaScript code will be more resilient to change; web platform native technologies like core JavaScript rarely if ever make backwards incompatible changes. A user library like jQuery can and has made updates that require API refactors.&lt;/p&gt;
&lt;p&gt;Replicating jQuery&#39;s &lt;code&gt;parseHTML()&lt;/code&gt; method is the latest addition to core JavaScript. However, that alternative, &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Document/parseHTMLUnsafe_static#browser_compatibility&quot;&gt;&lt;code&gt;parseUnsafeHTML()&lt;/code&gt;&lt;/a&gt;, has wide browser support, back to Safari 17.4, so should be generally safe to use.&lt;/p&gt;
&lt;h2 id=&quot;additional-resources&quot; tabindex=&quot;-1&quot;&gt;Additional Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://youmightnotneedjquery.com&quot;&gt;You Might Not Need jQuery&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Use relative units in CSS for resizable content</title>
    <link href="https://architecture.lullabot.com/adr/20250320-use-relative-units-in-css/" />
    <updated>2025-03-20T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20250320-use-relative-units-in-css/</id>
    <summary type="html">Using relative units improves accessibility by ensuring that text and content does not overlap when zooming web pages or changing the base font size.</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="css" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use &lt;a href=&quot;https://www.w3.org/TR/css-values-3/#relative-lengths&quot;&gt;relative length&lt;/a&gt; units (such as &lt;code&gt;rem&lt;/code&gt;) for all applicable properties.&lt;/p&gt;
&lt;h2 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://www.w3.org/TR/css-values-3/#absolute-lengths&quot;&gt;Absolute length&lt;/a&gt; units should be used for the following properties, instead of relative ones.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;border&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;border-radius&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;box-shadow&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;outline&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Any decorative property where it is unexpected for it to scale with the type size.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A &lt;a href=&quot;https://css-tricks.com/almanac/properties/l/line-height/#aa-unitless-line-heights&quot;&gt;unitless value&lt;/a&gt; should be used for &lt;code&gt;line-height&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Pages will be more accessible as &lt;a href=&quot;https://css-tricks.com/accessible-font-sizing-explained/&quot;&gt;fonts will respect browser preferences&lt;/a&gt; and &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/css-rem-vs-em-units#compounding-effect-trouble-in-paradise&quot;&gt;font sizes will not compound with each other&lt;/a&gt;. The same is true for content with &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/css-css-units-explained#relative-units&quot;&gt;other relative units&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;additional-resources&quot; tabindex=&quot;-1&quot;&gt;Additional Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://css-tricks.com/accessible-font-sizing-explained/&quot;&gt;Accessible Font Sizing, Explained&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://austingil.com/px-or-rem-in-css/&quot;&gt;PX or REM in CSS? Just Use REM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.joshwcomeau.com/css/surprising-truth-about-pixels-and-accessibility/&quot;&gt;The Surprising Truth About Pixels and Accessibility&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.aleksandrhovhannisyan.com/blog/use-rems-for-font-size/&quot;&gt;Use Rems for Font Size to Respect User Preferences&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Use only one h1 on each page</title>
    <link href="https://architecture.lullabot.com/adr/20250124-use-one-h1-per-page/" />
    <updated>2025-01-24T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20250124-use-one-h1-per-page/</id>
    <summary type="html">Using one h1 on each page is best practice for accessibility and usability.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="accessibility" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will use only one &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; heading on each page as it is best practice for the following reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; headings are meant to be unique and quickly convey the purpose of the page to all users. This is the case whether the user is sighted, blind or visually impaired, has a cognitive disability, has any other disability, or has no disability.&lt;/li&gt;
&lt;li&gt;Screen reader users commonly use a &lt;a href=&quot;https://support.apple.com/guide/voiceover/with-the-voiceover-rotor-mchlp2719/mac&quot;&gt;web rotor&lt;/a&gt; to navigate web pages as it’s often faster for them to use. It quickly displays separate lists of headings, links, landmarks, form elements, etc.&lt;/li&gt;
&lt;li&gt;Having multiple &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; headings on one page ends up removing a meaningful page title from the page for screen reader users as it removes all context.&lt;/li&gt;
&lt;li&gt;A good exercise for sighted users is to imagine navigating quickly through a site where none of the pages have visual page titles. How would you have any context for the meaning of each page? You’d likely feel lost.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;more-information&quot; tabindex=&quot;-1&quot;&gt;More information&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.shimin.io/should-you-use-multiple-h1-s-in-2022/&quot;&gt;Should you use multiple h1 heading elements on your page in 2022?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.a11yproject.com/posts/how-to-accessible-heading-structure/&quot;&gt;A11yProject - Accessible heading structure - Headings in HTML&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://support.google.com/webmasters/thread/250613606/multiple-h1-tags-on-blogger?hl=en&quot;&gt;Multiple h1 tags on Blogger&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://dequeuniversity.com/rules/axe/4.1/page-has-heading-one&quot;&gt;Deque U - Page must contain a level-one heading&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements&quot;&gt;mdn docs - h1–h6: The HTML Section Heading elements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://sitechecker.pro/site-audit-issues/multiple-h1/&quot;&gt;How to Fix URLs with Multiple H1 Tags&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Having only one &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; on each page will easily and quickly convey the purpose of the page to all users, regardless of how they choose to view the page.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use description template for upstream patches in composer</title>
    <link href="https://architecture.lullabot.com/adr/20250109-use-issue-template-patches/" />
    <updated>2025-01-09T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20250109-use-issue-template-patches/</id>
    <summary type="html">When managing patches in a &lt;code&gt;composer.json&lt;/code&gt; file, clear and consistent descriptions improve maintainability and facilitate tooling. Currently, there is no standard template for describing patches, leading to inconsistent documentation.</summary>
    <category term="composer" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;All upstream patches listed in the &lt;code&gt;composer.json&lt;/code&gt; file &lt;strong&gt;MUST follow the standardized template&lt;/strong&gt; for their description.
Project specific patches &lt;strong&gt;MAY follow the standardized template&lt;/strong&gt;, and are encouraged to do so. The required format is
slightly different if there is a relevant URL for the issue to link to, or not.&lt;/p&gt;
&lt;p&gt;If there is an issue link:&lt;/p&gt;
&lt;pre class=&quot;language-txt&quot;&gt;&lt;code class=&quot;language-txt&quot;&gt;Issue #&amp;lt;issue-number&gt;: [&amp;lt;issue-title&gt;](&amp;lt;issue-link&gt;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If there is no issue link:&lt;/p&gt;
&lt;pre class=&quot;language-txt&quot;&gt;&lt;code class=&quot;language-txt&quot;&gt;Issue #&amp;lt;issue-number&gt;: &amp;lt;issue-title&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;pre class=&quot;language-shell&quot;&gt;&lt;code class=&quot;language-shell&quot;&gt;  - Issue &lt;span class=&quot;token comment&quot;&gt;#1234: [Implement the important feature](https://www.drupal.org/node/1234)&lt;/span&gt;
  - Issue &lt;span class=&quot;token comment&quot;&gt;#5678: [Fix compatibility with PHP 8.1](https://github.com/lullabot/my-php-library/pull/5678)&lt;/span&gt;
  - Issue &lt;span class=&quot;token comment&quot;&gt;#9101: Fix the important feature&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This labeling standard applies to patches originating from issue trackers, like Drupal.org, GitHub, or any other platform.&lt;/p&gt;
&lt;p&gt;When applicable, the issue number and title should directly reference the original issue in its respective tracker, providing clarity and traceability.
Implementation details:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;issue-number&amp;gt;&lt;/code&gt; refers to the identifier assigned to the issue by its respective tracker. This information is required.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;issue-title&amp;gt;&lt;/code&gt; matches the title of the issue or change request on the issue tracker. This information is required.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;issue-link&amp;gt;&lt;/code&gt; points to the original issue, or change request. It can also point to an internal issue tracker with more information about the reasons why the patch is needed. This information is optional.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Example entry in &lt;code&gt;composer.json&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token property&quot;&gt;&quot;extra&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;&quot;patches&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token property&quot;&gt;&quot;drupal/core&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token property&quot;&gt;&quot;Issue #1234: [Implement the important feature](https://www.drupal.org/node/1234)&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;patches/upstream/drupal/core/1234-important-feature.patch&quot;&lt;/span&gt;
         &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
         &lt;span class=&quot;token property&quot;&gt;&quot;lullabot/my-php-library&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token property&quot;&gt;&quot;Issue #5678: [Fix compatibility with PHP 8.4](https://github.com/lullabot/my-php-library/pull/5678)&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;patches/upstream/lullabot/my-php-library/5678.patch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;token property&quot;&gt;&quot;Issue #91011: Fix the important feature&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;patches/local/lullabot/my-php-library/91011.patch&quot;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Using a standarized format for describing patches in &lt;code&gt;composer.json&lt;/code&gt; will improve readability, and traceability. It will also simplify writing tooling that analyzes patches, or identifies common issues across different projects.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use 11ty to manage the ADRs</title>
    <link href="https://architecture.lullabot.com/adr/20240924-11ty-adr/" />
    <updated>2024-09-24T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20240924-11ty-adr/</id>
    <summary type="html">We need a site generator to publish our ADRs.</summary>
    <category term="meta" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will use &lt;a href=&quot;https://www.11ty.dev&quot;&gt;Eleventy (11ty)&lt;/a&gt; to generate a website for &lt;a href=&quot;https://architecture.lullabot.com&quot;&gt;architecture.lullabot.com&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;context&quot; tabindex=&quot;-1&quot;&gt;Context&lt;/h2&gt;
&lt;p&gt;We initially used &lt;a href=&quot;https://github.com/thomvaill/log4brains&quot;&gt;log4brains&lt;/a&gt; which
met many of our needs. However, it did not support key features like &lt;a href=&quot;https://github.com/thomvaill/log4brains/issues/4&quot;&gt;embedding local images&lt;/a&gt;,
and went through a through a period of minimal maintainership.&lt;/p&gt;
&lt;p&gt;Our team determined that creating our own theme would be more effective for our
needs. This led to using &lt;a href=&quot;https://www.gatsbyjs.com/&quot;&gt;Gatsby&lt;/a&gt;, which worked, but was overly complex for our use-case. Team members reported having difficulties running the gatsby project locally as well as handling the coordination of features between our internal ADR site and our public Gatsby theme for the ADR site.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;While 11ty is still a tool our team will need to maintain, it has fewer dependencies and does not need React knowledge to contribute and maintain the site. As well, build times are much faster compared to Gatsby. This should lead to more Lullabots being able to contribute fixes and features and reduce the amount of time spent on tasks.&lt;/p&gt;
&lt;p&gt;The 11ty community does not have the concept of &amp;quot;themes&amp;quot;, but rather &amp;quot;starter templates&amp;quot;. We will not be able to maintain a community theme for the ADR site like we did for Gatsby.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Document project setup in README.md</title>
    <link href="https://architecture.lullabot.com/adr/20240820-project-docs/" />
    <updated>2024-08-20T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20240820-project-docs/</id>
    <summary type="html">Documentation for getting started on a project should always be found in the same place and use the same formatting.</summary>
    <category term="documentation" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;For consistency and to ease onboarding, all projects should have a &lt;code&gt;README.md&lt;/code&gt; file at the root of the repository.&lt;/p&gt;
&lt;p&gt;The README will start with the following template. It is important that &lt;code&gt;h1&lt;/code&gt; tags (the &lt;code&gt;#&lt;/code&gt;) are only used for the very first project name heading, and &lt;code&gt;h2&lt;/code&gt;s and lower are used for further sections. GitHub and other tools will automatically use these to create a table of contents.&lt;/p&gt;
&lt;pre class=&quot;language-md&quot;&gt;&lt;code class=&quot;language-md&quot;&gt;&lt;span class=&quot;token title important&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;#&lt;/span&gt; Project Name&lt;/span&gt;

&lt;span class=&quot;token italic&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;token content&quot;&gt;A short introduction describing the project and its purpose.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;_&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;token title important&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;##&lt;/span&gt; Getting Started&lt;/span&gt;
&lt;span class=&quot;token title important&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;##&lt;/span&gt; Running Tests&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;Getting Started&lt;/code&gt; should contain the steps to clone the repository and have a working version of the code. A typical Drupal project will end with a fully functional Drupal site and a one-time login link.&lt;/p&gt;
&lt;h3 id=&quot;organizing-the-readme-file&quot; tabindex=&quot;-1&quot;&gt;Organizing the README File&lt;/h3&gt;
&lt;p&gt;Initially, projects should put documentation directly in the README. As it grows, consider splitting longer sections into new files in a &lt;code&gt;docs/&lt;/code&gt; directory, linked to from the README. Or better yet, see if setup and documentation can be simplified into fewer commands and steps.&lt;/p&gt;
&lt;p&gt;Good heuristics to use to know when to create a separate document include:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The scope and context is large enough to make trying to read it in a single file too cumbersome.&lt;/li&gt;
&lt;li&gt;The content is specific enough to a particular service or subsystem that it makes more sense to keep it with that service in a folder dedicated to that service (such as Storybook or Tugboat).&lt;/li&gt;
&lt;li&gt;The content is managed by an external source.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;documentation-scope&quot; tabindex=&quot;-1&quot;&gt;Documentation Scope&lt;/h3&gt;
&lt;p&gt;This applies to any documentation relevant to technical aspects of working with the project such as setting up a local environment and running tests.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Maintaining a consistent and organized documentation system for technical documentation will reduce the effort searching for common information. As well, it will avoid being dependent on other team members to get started on a project. Developers can work faster, make better decisions, and onboarding can happen more smoothly.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use SVGs for icons</title>
    <link href="https://architecture.lullabot.com/adr/20240221-use-svg-icons/" />
    <updated>2024-02-21T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20240221-use-svg-icons/</id>
    <summary type="html">Using SVGs for icons has the best display, performance, and accessibility</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="accessibility" scheme="https://architecture.lullabot.com/topics/" />
    <category term="performance" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Icons will use SVGs, either &lt;a href=&quot;https://css-tricks.com/using-svg/#aa-using-inline-svg&quot;&gt;inline&lt;/a&gt; or with &lt;a href=&quot;https://css-tricks.com/svg-symbol-good-choice-icons/&quot;&gt;the symbol tag&lt;/a&gt;, instead of an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag or an icon font.&lt;/p&gt;
&lt;h2 id=&quot;context&quot; tabindex=&quot;-1&quot;&gt;Context&lt;/h2&gt;
&lt;p&gt;SVGs provide the best display, performance, and accessibility for icon graphics, or any graphics that use simple geometric shapes.&lt;/p&gt;
&lt;p&gt;This is because SVGs are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Resolution independent, so they always look the same on any screen or zoom level&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://css-tricks.com/accessible-svgs/&quot;&gt;Fully accessible&lt;/a&gt;, allowing authors to adapt the material to the context&lt;/li&gt;
&lt;li&gt;Can be fully styled from CSS (if inlined or included via &lt;code&gt;&amp;lt;symbol&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Part of the page, not requiring additional network requests (if inlined or included via &lt;code&gt;&amp;lt;symbol&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.w3.org/TR/SVG-access/&quot;&gt;Preferred by the W3C&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Icons will be more accessible, performant, and attractive.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Do not use placeholder text in form fields</title>
    <link href="https://architecture.lullabot.com/adr/20240212-do-not-use-placeholders-forms/" />
    <updated>2024-02-12T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20240212-do-not-use-placeholders-forms/</id>
    <summary type="html">Placeholder text introduces significant usability and accessibility issues and should be avoided.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="editorial-experience" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use placeholder text in fields as little as possible, favoring static field labels and help text.&lt;/p&gt;
&lt;p&gt;Common issues with placeholders include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Insufficent contrast between the placeholder and the text field.&lt;/li&gt;
&lt;li&gt;Issues perceiving the placeholder as it vanishes when content is entered.&lt;/li&gt;
&lt;li&gt;Poor display for users browsing with &lt;a href=&quot;https://www.smashingmagazine.com/2022/06/guide-windows-high-contrast-mode/&quot;&gt;Windows High Contrast Mode&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For in-depth explanations, see the following resources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.smashingmagazine.com/2018/06/placeholder-attribute/&quot;&gt;Don’t Use The Placeholder Attribute&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.w3.org/WAI/tutorials/forms/instructions/#placeholder-text&quot;&gt;Placeholder text in W3.org&#39;s Form Instructions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.deque.com/blog/accessible-forms-the-problem-with-placeholders/&quot;&gt;The Anatomy of Accessible Forms: The Problem with Placeholders&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Forms will be more usable for a variety of users. Designers and developers will need to remember not to use placeholder settings in form designs, when configuring Drupal fields, or developing custom forms.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Order content type form fields based on content priority</title>
    <link href="https://architecture.lullabot.com/adr/20231110-field-order-as-in-page/" />
    <updated>2023-11-10T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20231110-field-order-as-in-page/</id>
    <summary type="html">When content types have dedicated pages, matching the display order when possible makes edit forms easier to understand.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="editorial-experience" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;When a content type has required fields, those fields appear first in the edit form. When a content type shares fields
with content types, those fields appear in the same field order position on the other content types. For example, if
multiple content types share a Topics vocabulary field, that field should appear in roughly the same portion of the
edit form on each edit form.&lt;/p&gt;
&lt;h3 id=&quot;specific-recommendations&quot; tabindex=&quot;-1&quot;&gt;Specific recommendations&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Title (or name) field will always come first.&lt;/li&gt;
&lt;li&gt;Required fields come next. If they are shared across content types, use a consistent field order across those
content types.&lt;/li&gt;
&lt;li&gt;Then follow the content hierarchy order as it appears in a single column in the design, or on the content type&#39;s
full page once it&#39;s built.&lt;/li&gt;
&lt;li&gt;Fields that are controls for showing or hiding fields conditionally in the edit form should be ordered in the form
based on what content priority their child fields have.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Design decisions may not follow content hierarchy. For example a news category term may appear above the title in the
design, even though the term is less important than the title.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Load JavaScript as external resource with defer attribute</title>
    <link href="https://architecture.lullabot.com/adr/20231027-javascript-loading-defaults/" />
    <updated>2023-10-27T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20231027-javascript-loading-defaults/</id>
    <summary type="html">Loading JavaScript as deferred has the best default performance</summary>
    <category term="javascript" scheme="https://architecture.lullabot.com/topics/" />
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="performance" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;When loading external JavaScript files in HTML, they will have the &lt;code&gt;defer&lt;/code&gt; attribute.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/path/to/file.js&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;defer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When adding JavaScript files with Drupal Libraries, this will require adding the &lt;code&gt;defer&lt;/code&gt; attribute on a per-file basis:&lt;/p&gt;
&lt;pre class=&quot;language-yml&quot;&gt;&lt;code class=&quot;language-yml&quot;&gt;&lt;span class=&quot;token key atrule&quot;&gt;my_library&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;token key atrule&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1.0.0
  &lt;span class=&quot;token key atrule&quot;&gt;js&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token key atrule&quot;&gt;js/my-script.js&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;token key atrule&quot;&gt;attributes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;token key atrule&quot;&gt;defer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean important&quot;&gt;true&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;context&quot; tabindex=&quot;-1&quot;&gt;Context&lt;/h2&gt;
&lt;p&gt;Adding &lt;code&gt;defer&lt;/code&gt; to &lt;code&gt;&amp;lt;script src=&amp;quot;...&amp;quot;&amp;gt;&lt;/code&gt; tags will create the most performant page-loading experience:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;async&lt;/code&gt; attribute tells the browser to continue parsing HTML while the JavaScript file is downloading, but to allow the script to interrupt parsing for execution.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;defer&lt;/code&gt; attribute tells the browser to avoid executing the JavaScript until the entire document has been parsed. Scripts with the defer attribute will be fetched asynchronously by default. Without the &lt;code&gt;defer&lt;/code&gt; attribute, the initial rendering of the page could be significantly delayed on devices with older or slower processors.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Avoid using both &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;defer&lt;/code&gt; on a &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag as &lt;code&gt;defer&lt;/code&gt; already provides all the benefits of &lt;code&gt;async&lt;/code&gt; and adding both may result in inconsistent or undesirable cross-browser behavior.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h2&gt;
&lt;p&gt;There are rare instances when JavaScript should be added into the body of the HTML document, such as removing a &lt;code&gt;no-js&lt;/code&gt; class from the &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; element. In this case, inline blocking JavaScript is preferable to avoid cumulative layout shifts and perceived reflows of the document. For example, in the code below, the HTML document is sent to the browser with a &lt;code&gt;no-js&lt;/code&gt; class to prevent displaying portions of the page that require JavaScript. By adding an inline style early in the document, we can prevent the browser from rendering the page once with the &lt;code&gt;no-js&lt;/code&gt; class and then reflowing when &lt;code&gt;no-js&lt;/code&gt; is removed.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;html&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;no-js&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;span class=&quot;token language-javascript&quot;&gt;
      document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;remove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;no-js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token style&quot;&gt;&lt;span class=&quot;token language-css&quot;&gt;
      &lt;span class=&quot;token selector&quot;&gt;.no-js #app&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Requesting &amp;amp; executing JavaScript in this manner should lead to more performant page loading and the most consistent script execution since scripts will not run until the entire DOM is in place. This, in turn, will create a better experience for end-users and a better score on objective performance metrics.&lt;/p&gt;
&lt;h2 id=&quot;additional-resources&quot; tabindex=&quot;-1&quot;&gt;Additional Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script&quot;&gt;[MDN]: The Script Element&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/Performance/Optimizing_startup_performance&quot;&gt;[MDN]: Optimizing Startup Performance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://pagespeedchecklist.com/async-and-defer&quot;&gt;What&#39;s The Difference Between Async &amp;amp; Defer?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>[deprecated] Standardize the order of steps when building a Drupal site</title>
    <link href="https://architecture.lullabot.com/adr/20230929-drupal-build-steps/" />
    <updated>2023-10-04T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20230929-drupal-build-steps/</id>
    <summary type="html">When updating Drupal code and configuration in a given environment, it&#39;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.</summary>
    <category term="drush" scheme="https://architecture.lullabot.com/topics/" />
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="deployments" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;This ADR has been replaced&lt;/strong&gt; &lt;a href=&quot;https://architecture.lullabot.com/adr/20260313-drupal-build-steps&quot;&gt;by this new version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We standardize the build steps as:&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;vendor/bin/drush cache:rebuild &lt;span class=&quot;token parameter variable&quot;&gt;--yes&lt;/span&gt;
vendor/bin/drush updatedb &lt;span class=&quot;token parameter variable&quot;&gt;--yes&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Run config:import twice to make sure we catch any config that didn&#39;t declare&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# a dependency correctly. This is also useful when importing large config sets&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# as it can sometimes hit an out of memory error.&lt;/span&gt;
vendor/bin/drush config:import &lt;span class=&quot;token parameter variable&quot;&gt;--yes&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;
vendor/bin/drush config:import &lt;span class=&quot;token parameter variable&quot;&gt;--yes&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Run update hooks that need to be run after config import. These need to be&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# written as hook_deploy_NAME() hooks.&lt;/span&gt;
vendor/bin/drush deploy:hook &lt;span class=&quot;token parameter variable&quot;&gt;--yes&lt;/span&gt;
vendor/bin/drush cache:rebuild &lt;span class=&quot;token parameter variable&quot;&gt;-y&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Developers should write update hooks using these guidelines:&lt;/p&gt;
&lt;h3 id=&quot;hook_update_n()&quot; tabindex=&quot;-1&quot;&gt;&lt;a href=&quot;https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!module.api.php/function/hook_update_N&quot;&gt;&lt;code&gt;HOOK_update_N()&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Code that does not rely on any Drupal services, entity CRUD operations,
entity APIs, router system, etc, usually to perform direct database queries.
Check &lt;a href=&quot;https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!module.api.php/function/hook_update_N&quot;&gt;the documentation&lt;/a&gt;
for more details about what is safe to use in these hooks.&lt;/p&gt;
&lt;p&gt;These hooks are the first ones to be executed, before configuration is imported.&lt;/p&gt;
&lt;h3 id=&quot;hook_post_update_name()&quot; tabindex=&quot;-1&quot;&gt;&lt;a href=&quot;https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!module.api.php/function/hook_post_update_NAME&quot;&gt;&lt;code&gt;HOOK_post_update_NAME()&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;These are called when Drupal is fully bootstrapped and all Drupal APIs are
safe to use. This is usually the place to write code that needs to alter content
but doesn&#39;t require the new configuration in place, since these hooks will be
executed before configuration is imported.&lt;/p&gt;
&lt;h3 id=&quot;hook_deploy_name()&quot; tabindex=&quot;-1&quot;&gt;&lt;a href=&quot;https://github.com/drush-ops/drush/tree/HEAD/drush.api.php&quot;&gt;&lt;code&gt;HOOK_deploy_NAME()&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;These are equivalent to &lt;code&gt;HOOK_post_update_NAME()&lt;/code&gt; in terms of APIs available,
the only difference being that this is executed &lt;em&gt;after&lt;/em&gt; configuration is
imported.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Developers have a clear and consistent guide to use update hooks among
projects.&lt;/li&gt;
&lt;li&gt;Automation can be built to ensure these steps are executed consistently.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>[deprecated] Load JavaScript as external resource with async and defer attributes</title>
    <link href="https://architecture.lullabot.com/adr/20230804-javascript-loading-defaults/" />
    <updated>2023-08-04T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20230804-javascript-loading-defaults/</id>
    <summary type="html">Loading JavaScript as async &amp;amp; deferred has the best default performance</summary>
    <category term="javascript" scheme="https://architecture.lullabot.com/topics/" />
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="performance" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;This ADR has been replaced&lt;/strong&gt; by &lt;a href=&quot;https://architecture.lullabot.com/adr/20231027-javascript-loading-defaults&quot;&gt;this new version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When loading external JavaScript files in HTML, they will have the &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;defer&lt;/code&gt; attributes.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/path/to/file.js&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;defer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When adding JavaScript files with Drupal Libraries, this will require adding the &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;defer&lt;/code&gt; attributes on a per-file basis:&lt;/p&gt;
&lt;pre class=&quot;language-yml&quot;&gt;&lt;code class=&quot;language-yml&quot;&gt;&lt;span class=&quot;token key atrule&quot;&gt;my_library&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;token key atrule&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1.0.0
  &lt;span class=&quot;token key atrule&quot;&gt;js&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token key atrule&quot;&gt;js/my-script.js&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;token key atrule&quot;&gt;attributes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;token key atrule&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean important&quot;&gt;true&lt;/span&gt;
        &lt;span class=&quot;token key atrule&quot;&gt;defer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean important&quot;&gt;true&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;context&quot; tabindex=&quot;-1&quot;&gt;Context&lt;/h2&gt;
&lt;p&gt;Adding &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;defer&lt;/code&gt; to &lt;code&gt;&amp;lt;script src=&amp;quot;...&amp;quot;&amp;gt;&lt;/code&gt; tags will create the most performant page-loading experience:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;async&lt;/code&gt; attribute tells the browser to continue parsing HTML while the JavaScript file is downloading. Without the &lt;code&gt;async&lt;/code&gt; attribute, the initial rendering of the page could be significantly delayed on devices with a slower connection speed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;defer&lt;/code&gt; attribute tells the browser to avoid executing the JavaScript until the entire document has been parsed. Without the &lt;code&gt;defer&lt;/code&gt; attribute, the initial rendering of the page could be significantly delayed on devices with older or slower processors.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By adding both the &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;defer&lt;/code&gt; attributes on &lt;code&gt;&amp;lt;script src=&amp;quot;...&amp;quot;&amp;gt;&lt;/code&gt; tags, we minimize the impact of external JavaScript files as much as possible.&lt;/p&gt;
&lt;h2 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h2&gt;
&lt;p&gt;There are rare instances when JavaScript should be added into the body of the HTML document, such as removing a &lt;code&gt;no-js&lt;/code&gt; class from the &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; element. In this case, inline blocking JavaScript is preferable to avoid cumulative layout shifts and perceived reflows of the document. For example, in the code below, the HTML document is sent to the browser with a &lt;code&gt;no-js&lt;/code&gt; class to prevent displaying portions of the page that require JavaScript. By adding an inline style early in the document, we can prevent the browser from rendering the page once with the &lt;code&gt;no-js&lt;/code&gt; class and then reflowing when &lt;code&gt;no-js&lt;/code&gt; is removed.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;html&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;no-js&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;span class=&quot;token language-javascript&quot;&gt;
      document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;remove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;no-js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token style&quot;&gt;&lt;span class=&quot;token language-css&quot;&gt;
      &lt;span class=&quot;token selector&quot;&gt;.no-js #app&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Requesting &amp;amp; executing JavaScript in this manner should lead to more performant page loading and the most consistent script execution since scripts will not run until the entire DOM is in place. This, in turn, will create a better experience for end-users and a better score on objective performance metrics.&lt;/p&gt;
&lt;h2 id=&quot;additional-resources&quot; tabindex=&quot;-1&quot;&gt;Additional Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script&quot;&gt;[MDN]: The Script Element&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/Performance/Optimizing_startup_performance&quot;&gt;[MDN]: Optimizing Startup Performance&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Use Typed Entity to encapsulate business logic in dedicated classes</title>
    <link href="https://architecture.lullabot.com/adr/20230309-use-typed-entity/" />
    <updated>2023-03-09T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20230309-use-typed-entity/</id>
    <summary type="html">Wrapping the business logic for an entity using Typed Entity produces code that is easier to read, maintain, test, and discover.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="code quality" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;context&quot; tabindex=&quot;-1&quot;&gt;Context&lt;/h2&gt;
&lt;p&gt;It is well understood that having dedicated classes in object-oriented systems produces more maintainable systems. However, Drupal has a history of procedural code with &amp;quot;hooks&amp;quot; that spread business logic widely throughout a Drupal application.&lt;/p&gt;
&lt;p&gt;The main alternative that we have considered is &lt;a href=&quot;https://www.drupal.org/node/3191609&quot;&gt;Drupal core’s bundle classes&lt;/a&gt;. We determined that Typed Entity is a better solution for all the reasons highlighted in &lt;a href=&quot;https://www.lullabot.com/articles/drupals-bundle-classes-empower-better-code&quot;&gt;this article comparing them&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Some of the advantages of Typed Entity over bundle classes are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Reduced API surface.&lt;/li&gt;
&lt;li&gt;Decouples classes from bundles. It allows more than one class per bundle.&lt;/li&gt;
&lt;li&gt;Keeps custom logic and framework logic separated.&lt;/li&gt;
&lt;li&gt;Flexible architecture.&lt;/li&gt;
&lt;li&gt;Has separation of concerns with rendering logic.&lt;/li&gt;
&lt;li&gt;Includes “repository” classes, which will avoid the need of static methods.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Advantages of bundle classes over Typed Entity:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Available in Drupal core. This makes it ubiquitous and well maintained.&lt;/li&gt;
&lt;li&gt;Custom classes are instantiated without having to wrap them.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All things considered, we have decided that use of Typed Entity far outweighs bundle classes for encapsulating business logic in our projects.&lt;/p&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;All new projects at Lullabot should use Typed Entity to wrap entities so that&#39;s easier to interact with them from other
code. This includes logic around loading entities from the database, creating entities, etc., that would otherwise be
spread around different files in code.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Encapsulating business logic in their own objects will make said logic more understandable, easier to find, less error
prone, and more reusable.&lt;/p&gt;
&lt;p&gt;The developers can see their experience improved with IDE autocomplete.&lt;/p&gt;
&lt;p&gt;The use of Repository classes will bring similar results and a more expressive organization around how entities are
stored and loaded. This will lead to increased developer and client satisfaction.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Leverage view modes when rendering entities</title>
    <link href="https://architecture.lullabot.com/adr/20221205-render-entities-with-view-modes/" />
    <updated>2022-12-14T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20221205-render-entities-with-view-modes/</id>
    <summary type="html">Rendering entities using view modes have multiple benefits. These include better maintainability, faster initial development time, better performance, and hardened security.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;!-- Here begins Markdown and HTML --&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will favor rendering entities through view modes, even when we are not implementing a design system. We will also
aim for minimal business logic inside of the template. We will, preferably, code this logic in preprocess functions,
bundle class getters, and entity hooks.&lt;/p&gt;
&lt;p&gt;Dedicated view modes are recommended for every different way of rendering a non-page entity (micro-content, embedded
nodes, etc.). This will ensure that all the cacheability metadata is correctly added to the page. This is true, even
when only a single field is needed from an entity.&lt;/p&gt;
&lt;p&gt;When the raw data of a field is needed, likely to use as data for a single-directory component, the
&lt;a href=&quot;https://www.drupal.org/project/nomarkup&quot;&gt;No Markup&lt;/a&gt; module is the recommended approach. This module lets you remove
the field markup, by checking a checkbox, while rendering the entity using a view mode. In the edge cases when this
module is not enough, a preprocessed variable from the back-end should be provided (using Type Entity&#39;s renderers).&lt;/p&gt;
&lt;h3 id=&quot;background&quot; tabindex=&quot;-1&quot;&gt;Background&lt;/h3&gt;
&lt;p&gt;This ADR puts in writing an existing practice at Lullabot. However, there are occasions where we might work with
external vendors, our client&#39;s staff, or junior devs who work with different practices and conventions. This ADR aims
to highlight the need to check for these situations and correct them if possible.&lt;/p&gt;
&lt;p&gt;View modes are even more recommended when the client is implementing a design system for the entity component designs.&lt;/p&gt;
&lt;h3 id=&quot;potential-exceptions&quot; tabindex=&quot;-1&quot;&gt;Potential Exceptions&lt;/h3&gt;
&lt;p&gt;Examples of situations where we &lt;strong&gt;should&lt;/strong&gt; use a view mode:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Rendering looks generic enough that it would make sense as an item in a View of entities.&lt;/li&gt;
&lt;li&gt;The representation has a clear meaning in the customer’s or project&#39;s design language, even if it is not generic or
reusable.&lt;/li&gt;
&lt;li&gt;If the creation of a view mode seems to imply other new view modes for every single variation, we still use a view
mode. However, we keep it to a single (or few) view modes and leverage pre-processing to prepare the template values.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Examples of situations where we &lt;strong&gt;should not&lt;/strong&gt; use a view mode:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The representation is not generic at all, very bespoke rendering logic with context-dependent or request-dependent
alters. In this case maybe a theme function or a custom render element can handle it.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;additional-considerations&quot; tabindex=&quot;-1&quot;&gt;Additional Considerations&lt;/h3&gt;
&lt;p&gt;In order to improve inline documentation for display modes, we have developed the Drupal module
&lt;a href=&quot;https://www.drupal.org/project/dmg&quot;&gt;Display Mode Guidelines&lt;/a&gt;. This module aims to promote an appropriate use of each view mode and to avoid
unnecessary proliferation of view modes.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Sites following this ADR will be more performant, will suffer from fewer bugs related to entity rendering, and will
take less time to implement.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use [ticket-id]--[short-description] in feature branch names</title>
    <link href="https://architecture.lullabot.com/adr/20220920-git-branch-naming/" />
    <updated>2022-09-20T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220920-git-branch-naming/</id>
    <summary type="html">Omitting key information in branch names can cause confusion over the purpose of a branch.</summary>
    <category term="git" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use &lt;code&gt;[ticket-id]--[short-description]&lt;/code&gt; as the branch name when creating a new
feature branch. If a ticket doesn&#39;t exist, use a consistent keyword in place of a ticket ID. Suggested keywords include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NOTICKET&lt;/code&gt;: general purpose prefix for any time there is no ticket.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;0&lt;/code&gt;: An alternative general purpose prefix.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;HOTFIX&lt;/code&gt;: used for a branch containing a hotfix that does not have an
associated ticket.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Do not use forward slashes (&lt;code&gt;/&lt;/code&gt;) in branch names as this can cause confusion
and errors when trying to &lt;a href=&quot;https://stackoverflow.com/questions/2527355/using-the-slash-character-in-git-branch-name/2527452#2527452&quot;&gt;interact with branches sharing prefixes&lt;/a&gt;.
For example, it is not possible to create a branch called &lt;code&gt;new-homepage&lt;/code&gt; if
another branch called &lt;code&gt;new-homepage/fix-heading&lt;/code&gt; exists. This can also cause
errors when pulling if a new branch conflicts with a local-only branch.&lt;/p&gt;
&lt;h2 id=&quot;examples&quot; tabindex=&quot;-1&quot;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Here are some examples of good branch names:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;wta-249--scaffold-alert-content-type&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;wta-NOTICKET--fix-tests-in-head&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;wta-0--fix-tests-in-head&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;HOTFIX--remove-has-krumo&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;143--git-naming-conventions&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;NOTICKET--troubleshoot-ci&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Teams can choose to implement pull-request checks or pre-commit hooks that
validate branch names based off of a simple regular expression. For example,
the following command would fail if the branch name did not contain two dashes:&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; rev-parse --abbrev-ref HEAD &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-qE&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;^main$|&#92;-&#92;-&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
  &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Please use the format [ticket-id]--[short-description] in branch names&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token file-descriptor important&quot;&gt;&amp;amp;2&lt;/span&gt;
  &lt;span class=&quot;token builtin class-name&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Developers can use branch names to automate commit messages and other common
tasks, such as &lt;a href=&quot;https://git.drupalcode.org/sandbox/deviantintegral-1080778/-/blob/master/bin/git-ici&quot;&gt;in this git commit message example&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use identical cache backends on development environments</title>
    <link href="https://architecture.lullabot.com/adr/20220906-identical-cache-backends/" />
    <updated>2022-09-06T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220906-identical-cache-backends/</id>
    <summary type="html">Using memory caches like Memcached or Redis in production but not in development environments can lead to bugs and confusion.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="devops" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Development environments (like &lt;a href=&quot;https://tugboat.qa&quot;&gt;Tugboat&lt;/a&gt;) will use the same cache backend as production environments. Local environments will also use the same backend.&lt;/p&gt;
&lt;p&gt;Using different cache backends on non-production environments can lead to tricky bugs that are hard to diagnose. For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When production environments change cache backends, such as from database caching to a memory cache, it is possible for stale entries to be left in the database. These entries may cause unexpected behaviour on other environments if they are still using the default database backend.&lt;/li&gt;
&lt;li&gt;Automated tests may miss production bugs if the bug only occurs when using a memory cache backend.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Projects using &lt;a href=&quot;https://architecture.lullabot.com/adr/20211207-ddev-locals/&quot;&gt;ddev&lt;/a&gt; should use &lt;a href=&quot;https://github.com/drud/ddev-memcached&quot;&gt;ddev-memcached&lt;/a&gt; or &lt;a href=&quot;https://github.com/drud/ddev-redis&quot;&gt;ddev-redis&lt;/a&gt; to add the appropriate cache server.&lt;/p&gt;
&lt;p&gt;Tugboat images for both &lt;a href=&quot;https://docs.tugboatqa.com/reference/tugboat-images/&quot;&gt;Memcached and Redis&lt;/a&gt; are also available.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;All environments will be more consistent with each other, reducing the chances of &amp;quot;it only happens in production&amp;quot; bugs.&lt;/p&gt;
&lt;p&gt;Developers working on local environments may be surprised to not see cache entries in the database. Inspecting caches with database tools like PHPStorm&#39;s database viewer is simpler than inspecting Memcached or Redis contents. They will need to become familiar with Drush&#39;s &lt;a href=&quot;https://www.drush.org/latest/commands/cache_get/&quot;&gt;cache:get&lt;/a&gt; command.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use JavaScript strict mode</title>
    <link href="https://architecture.lullabot.com/adr/20220816-use-js-strict-mode/" />
    <updated>2022-08-16T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220816-use-js-strict-mode/</id>
    <summary type="html">Opt in to settings that raise errors for problematic code.</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="javascript" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use JavaScript&#39;s &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode&quot;&gt;strict mode&lt;/a&gt; within all top-level
functions (nested functions will inherit strict mode).&lt;/p&gt;
&lt;p&gt;If the project only includes non-vendor code in a bundle, strict mode
can be declared once at the top of the bundle file, instead of per
function. When in doubt, declare strict mode per function.&lt;/p&gt;
&lt;p&gt;If using &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules&quot;&gt;ES modules&lt;/a&gt;, strict mode is implied, and should not be declared.&lt;/p&gt;
&lt;h3 id=&quot;use-eslint-to-detect-non-strict-files&quot; tabindex=&quot;-1&quot;&gt;Use ESLint to detect non-strict files&lt;/h3&gt;
&lt;p&gt;Use &lt;a href=&quot;https://eslint.org/docs/latest/rules/strict&quot;&gt;ESLint&#39;s strict rule&lt;/a&gt;
to detect and enforce strict mode, if you are already using ESLint in
your project.&lt;/p&gt;
&lt;p&gt;Add &lt;code&gt;strict&lt;/code&gt; to the &lt;code&gt;rules&lt;/code&gt; section of your ESLint configuration file.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token literal-property property&quot;&gt;strict&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&#39;error&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&#39;safe&#39;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Some popular rule sets, like &lt;code&gt;airbnb-base&lt;/code&gt;, &lt;a href=&quot;https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/strict.js&quot;&gt;may not include&lt;/a&gt; this rule. Adding it to the eslint configuration file will ensure it is applied.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;JavaScript errors will be more noticeable, leading to better code quality.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use SMACSS to organize CSS within projects</title>
    <link href="https://architecture.lullabot.com/adr/20220721-organize-stylesheets-using-smacss/" />
    <updated>2022-07-21T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220721-organize-stylesheets-using-smacss/</id>
    <summary type="html">Organizing CSS within projects the same way Drupal organizes its CSS establishes a consistent pattern.</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="css" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will use the &lt;a href=&quot;http://smacss.com/&quot;&gt;Scalable and Modular Architecture for CSS&lt;/a&gt; (SMACSS) methodology to organize CSS. This methodology can be applied to any project, whether it be a Drupal project (where this convention is &lt;a href=&quot;https://www.drupal.org/node/1887922&quot;&gt;currently used&lt;/a&gt;) or any other front-end project.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;By standardizing on a CSS organization methodology across projects, developers can easily organize their styles using a common system. Developers new to a project will already know how the CSS will be organized, allowing them to quickly contribute to a new codebase.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use TypeScript for pure JavaScript development</title>
    <link href="https://architecture.lullabot.com/adr/20220705-use-typescript/" />
    <updated>2022-07-05T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220705-use-typescript/</id>
    <summary type="html">Strictly typed languages like TypeScript avoid unexpected behavior, prevent bugs, and improve code maintainability.</summary>
    <category term="javascript" scheme="https://architecture.lullabot.com/topics/" />
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="back-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="developer-experience" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;p&gt;Bugs introduced by missing types are hard to find and often present themselves as edge cases. &lt;a href=&quot;https://www.typescriptlang.org/&quot;&gt;TypeScript&lt;/a&gt; is a superset of JavaScript that introduces static types for JavaScript code (among other features).&lt;/p&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will favor TypeScript over JavaScript when authoring code for front-end development using a JS framework, or back-end development using Node.js.&lt;/p&gt;
&lt;h3 id=&quot;considerations&quot; tabindex=&quot;-1&quot;&gt;Considerations&lt;/h3&gt;
&lt;p&gt;This decision is backed by peer-reviewed and cited research papers that prove that TypeScript indeed reduces the number of bugs introduced. These include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stefan Hanenberg, Sebastian Kleinschmager, Romain Robbes, Éric Tanter, and Andreas Stefik. 2014. &lt;strong&gt;An empirical study on the impact of static typing on software maintainability.&lt;/strong&gt; Empirical Software Engineering 19, 5 (2014), 1335ś1382. &lt;a href=&quot;https://doi.org/10.1007/s10664-013-9289-1&quot;&gt;https://doi.org/10.1007/s10664-013-9289-1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Clemens Mayer, Stefan Hanenberg, Romain Robbes, Éric Tanter, and Andreas Stefik. 2012. &lt;strong&gt;An empirical study of the influence of static type systems on the usability of undocumented software.&lt;/strong&gt; In Proceedings of the 27th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2012, Tucson, AZ, USA, October 21-25, 2012. 683ś702. &lt;a href=&quot;https://doi.org/10.1145/2384616.2384666&quot;&gt;https://doi.org/10.1145/2384616.2384666&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Samuel Spiza and Stefan Hanenberg. 2014. &lt;strong&gt;Type names without static type checking already improve the usability of APIs (as long as the type names are correct): an empirical study.&lt;/strong&gt; In 13th International Conference on Modular- ity, MODULARITY ’14, Lugano, Switzerland, April 22-26, 2014. 99ś108. &lt;a href=&quot;https://doi.org/10.1145/2577080.2577098&quot;&gt;https://doi.org/10.1145/2577080.2577098&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Andreas Stuchlik and Stefan Hanenberg. 2011. &lt;strong&gt;Static vs. dynamic type systems: an empirical study about the relationship between type casts and development time.&lt;/strong&gt; In Proceedings of the 7th Symposium on Dynamic Languages, DLS 2011, October 24, 2011, Portland, OR, USA, Theo D’Hondt (Ed.). ACM, 97ś106. &lt;a href=&quot;https://doi.org/10.1145/2047849.2047861&quot;&gt;https://doi.org/10.1145/2047849.2047861&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;More specifically about TypeScript:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Zheng Gao, Christian Bird, and Earl T. Barr. 2017. &lt;strong&gt;To type or not to type: quantifying detectable bugs in JavaScript.&lt;/strong&gt; In Proceedings of the 39th International Conference on Software Engineering, ICSE 2017, Buenos Aires, Argentina, May 20-28, 2017, Sebastián Uchitel, Alessandro Orso, and Martin P. Robillard (Eds.). IEEE / ACM, 758ś769. &lt;a href=&quot;https://doi.org/10.1109/ICSE.2017.75&quot;&gt;https://doi.org/10.1109/ICSE.2017.75&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All the findings rely on code editor integrations for suggestions, and on the TypeScript compiler validation. Make sure to set those up in your local environment.&lt;/p&gt;
&lt;h3 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h3&gt;
&lt;p&gt;Some external tools and integrations do not support TypeScript. In those cases the use of JavaScript is accepted. This includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Configuration files for adjacent apps like Storybook.&lt;/li&gt;
&lt;li&gt;JavaScript code used for tooling, like &lt;code&gt;.eslintrc.js&lt;/code&gt;, &lt;code&gt;tailwind.config.js&lt;/code&gt;, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;We acknowledge that TypeScript code is more complex than JavaScript. This means that new features or changes will take longer to develop. We accept this cost because we expect to spend less time testing and bug fixing. We believe the balance is positive, as using TypeScript increases our efficiency.&lt;/p&gt;
&lt;p&gt;We will be more efficient because developers and quality assurance engineers will spend less time in the cycle of reporting and fixing bugs.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Do not add the Metatag field to the node form</title>
    <link href="https://architecture.lullabot.com/adr/20220622-1-do-not-add-metatags-to-node-form/" />
    <updated>2022-06-22T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220622-1-do-not-add-metatags-to-node-form/</id>
    <summary type="html">The metatag field makes the node form slow and overly complex for editorial users.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="node-form" scheme="https://architecture.lullabot.com/topics/" />
    <category term="editorial-experience" scheme="https://architecture.lullabot.com/topics/" />
    <category term="performance" scheme="https://architecture.lullabot.com/topics/" />
    <category term="seo" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will not enable the Metatags field to override metatags on content forms.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.drupal.org/project/metatag&quot;&gt;Metatag module&lt;/a&gt; is used to provide
metadata and SEO information. The easiest, most performant way to configure it is
to set values at the global or content type level, on the metatag settings using
tokens for the field values.&lt;/p&gt;
&lt;p&gt;There is a general consensus that the metadata should match the actual content
of the page it belongs to, so configuring it to use tokens that pull values
directly from that content is the ideal solution. It is always preferable to
any solution that hard-codes text into the metatag fields.&lt;/p&gt;
&lt;p&gt;There is also an option to add a metatag field to the node form via the
&amp;quot;Manage fields&amp;quot; form. It is used to allow editors to override the default values
provided by global or content type settings. This field creates a long, complex,
field that contains every possible metatag field option, allowing editors to
override the token values with their own custom text.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://architecture.lullabot.com/assets/images/adrs/20220622-1-do-not-add-metatags-to-node-form/metatags-field-config.png&quot; alt=&quot;Metatags field configuration&quot;&gt;&lt;/p&gt;
&lt;p&gt;There are several problems with this option. It allows editors to change the
metadata in ways that may make metadata inconsistent, or even invalid. It
adds unnecessary complexity to the node form that often has to be
hidden or managed with custom code. It also can create performance problems,
sometimes making the node form so heavy that it won&#39;t even load or save.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://architecture.lullabot.com/assets/images/adrs/20220622-1-do-not-add-metatags-to-node-form/metatags-article-form.png&quot; alt=&quot;Metatags on article form&quot;&gt;&lt;/p&gt;
&lt;p&gt;The best solution is to discuss why overrides are necessary, and eliminate
them whenever possible. Where they are necessary, it is better to provide a
regular Drupal field or fields just for the data that might be overridden.
Then, use a token for those fields in the content type configuration settings.&lt;/p&gt;
&lt;p&gt;The fields used for metadata can be configured with descriptions about what
metadata is needed and how it will be used. That information will be much
more clear than the standard Metatag field. Access to those fields can then be
restricted using standard options for Drupal field level access.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Editors will have a more streamlined experience when defining metatags,
and projects maintainability will be improved.&lt;/p&gt;
&lt;p&gt;We suggest discussing with clients this option and the reasons for using
this solution before adding the Metatag field to the node form on new
projects, as well as raising the question on inherited projects that already
use the Metatag field.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use CSS Logical Properties</title>
    <link href="https://architecture.lullabot.com/adr/20220622-use-css-logical-properties/" />
    <updated>2022-06-22T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220622-use-css-logical-properties/</id>
    <summary type="html">Decoupling styles from a language&#39;s writing direction makes them easier to maintain across translations.</summary>
    <category term="front-end" scheme="https://architecture.lullabot.com/topics/" />
    <category term="css" scheme="https://architecture.lullabot.com/topics/" />
    <category term="multilingual" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will use &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties&quot;&gt;CSS Logical Properties&lt;/a&gt; when writing styles that have a directional word or connotation to them. For example, instead of writing &lt;code&gt;margin-left&lt;/code&gt;, we will use &lt;code&gt;margin-inline-start&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&quot;enforcement-%26-automation&quot; tabindex=&quot;-1&quot;&gt;Enforcement &amp;amp; Automation&lt;/h3&gt;
&lt;p&gt;To help enforce this ADR, projects can utilize the &lt;a href=&quot;https://github.com/Jordan-Hall/stylelint-use-logical-spec&quot;&gt;&lt;code&gt;stylelint-use-logical-spec&lt;/code&gt;&lt;/a&gt; plugin for stylelint, and can use the &lt;code&gt;--fix&lt;/code&gt; flag to autofix errors detected for this ruleset.&lt;/p&gt;
&lt;h3 id=&quot;exceptions&quot; tabindex=&quot;-1&quot;&gt;Exceptions&lt;/h3&gt;
&lt;p&gt;Though rare, there may be cases where a specific directional term is needed or preferred. In these cases, &lt;a href=&quot;https://stylelint.io/user-guide/ignore-code/&quot;&gt;stylelint can be disabled&lt;/a&gt;, or &lt;a href=&quot;https://github.com/csstools/stylelint-use-logical#except&quot;&gt;specific exceptions can be set&lt;/a&gt; on the plugin referenced above.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Styles will support any writing direction by default, which makes them easier to maintain and reduces content internationalization hurdles.&lt;/p&gt;
&lt;p&gt;Styles will be less likely to have issues with specificity conflicts caused by localization overrides.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>[deprecated] Use gatsby-theme-adr to manage the ADRs</title>
    <link href="https://architecture.lullabot.com/adr/20220621-gatsby-theme-adr/" />
    <updated>2022-06-21T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220621-gatsby-theme-adr/</id>
    <summary type="html">We need a site generator to publish our ADRs.</summary>
    <category term="meta" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;p&gt;&lt;em&gt;Replaced by &lt;a href=&quot;https://architecture.lullabot.com/adr/20240913-11ty-adr/&quot;&gt;Use 11ty to manage the ADRs&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will use Gatsby along with a &lt;a href=&quot;https://github.com/Lullabot/gatsby-theme-adr&quot;&gt;gatsby subtheme&lt;/a&gt;
to generate a website for &lt;a href=&quot;https://architecture.lullabot.com&quot;&gt;architecture.lullabot.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We initially used &lt;a href=&quot;https://github.com/thomvaill/log4brains&quot;&gt;log4brains&lt;/a&gt; which
met many of our needs. However, it did not support key features like &lt;a href=&quot;https://github.com/thomvaill/log4brains/issues/4&quot;&gt;embedding local images&lt;/a&gt;,
and went through a through a period of minimal maintainership.
Our team determined that creating our own theme would be more effective for our
needs.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;We have expanded the possible scope for our team from being simply &amp;quot;users&amp;quot; of
ADR generator to developers and maintainers. We will need to respond to bug
reports and feature requests in a timely manner.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use Claro for the Drupal administration theme</title>
    <link href="https://architecture.lullabot.com/adr/20220519-use-claro-as-admin-theme/" />
    <updated>2022-05-19T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220519-use-claro-as-admin-theme/</id>
    <summary type="html">Claro offers a modern, responsive, and accessible interface that showcases Drupal&#39;s capabilities from the outset.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="editorial-experience" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Drupal sites will use the &lt;a href=&quot;https://www.drupal.org/docs/core-modules-and-themes/core-themes/claro-theme&quot;&gt;Claro administration theme&lt;/a&gt; to ensure a consistent client experience. Developers will use Claro to ensure accessibility and compatibility with contributed modules.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Standardizing its use across all Drupal sites ensures consistency for editors and developers across different sites. Using a built-in Drupal administration theme negates concerns about potentially unsupported/insecure contributed themes or an unfamiliar editorial experience.&lt;/p&gt;
&lt;p&gt;There may be specific client needs that Claro does not serve &amp;quot;out of the box&amp;quot;. These should be addressed through custom code or contributed modules, and not changing the administration theme.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use inclusive language in code and technical writing</title>
    <link href="https://architecture.lullabot.com/adr/20220511-use-inclusive-language/" />
    <updated>2022-05-11T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220511-use-inclusive-language/</id>
    <summary type="html">Inclusive language can make technical subjects more inviting and understandable.</summary>
    <content type="html">&lt;h2 id=&quot;context&quot; tabindex=&quot;-1&quot;&gt;Context&lt;/h2&gt;
&lt;p&gt;We are actively working on growing our team in an inclusive and diverse manner, and we work with clients with different backgrounds. We want to avoid terms with unintended connotations or nuances, and communicate our ideas more clearly by avoiding terms that do not translate well or require specific cultural knowledge to understand easily.&lt;/p&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;When writing code or technical documents, authors should favor inclusive language and semantically meaningful terms that better communicate the concepts intended.&lt;/p&gt;
&lt;p&gt;We won&#39;t override upstream systems using non-inclusive terminology, but we will file feature requests as appropriate, since using different terminology at the same time can be confusing.&lt;/p&gt;
&lt;p&gt;For existing code, we will follow the &lt;a href=&quot;https://www.drupal.org/project/config_split/issues/3191329&quot;&gt;model of Config Split&lt;/a&gt;, where they phased in changes until they had a 2.x branch where they broke compatibility.&lt;/p&gt;
&lt;h3 id=&quot;examples&quot; tabindex=&quot;-1&quot;&gt;Examples&lt;/h3&gt;
&lt;p&gt;When the term &amp;quot;master&amp;quot; could be used authors should substitute &amp;quot;default&amp;quot;, &amp;quot;primary&amp;quot;, &lt;a href=&quot;https://github.com/github/renaming&quot;&gt;or &amp;quot;main&amp;quot;&lt;/a&gt;, dependent upon the context of the usage. Similarly, terms derived from cultural analogies such as &amp;quot;black hat&amp;quot; and &amp;quot;whitelist&amp;quot; should be replaced with more semantically explicit terms like &amp;quot;nefarious actor&amp;quot; and &amp;quot;allow list&amp;quot;, respectively.&lt;/p&gt;
&lt;p&gt;When using pronouns in documentation, use gender-neutral singular &amp;quot;they&amp;quot; unless you&#39;re referencing a specific person. For example, instead of &amp;quot;After the user has filled out the form, she submits it&amp;quot; use &amp;quot;After the user has filled out the form, they submit it&amp;quot;.&lt;/p&gt;
&lt;p&gt;These posts on changing Git&#39;s default branch describe how different organizations improved terminology when that term was deeply embedded in software and documentation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.blog/changelog/2020-10-01-the-default-branch-for-newly-created-repositories-is-now-main/&quot;&gt;The default branch for newly-created repositories is now main (GitHub)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/&quot;&gt;The new Git default branch name (GitLab)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bitbucket.org/blog/moving-away-from-master-as-the-default-name-for-branches-in-git&quot;&gt;Moving away from Master as the default name for Branches in Git (Bitbucket)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To learn more about inclusive language, consider these resources. Note the content linked here may change over time and is not exhaustive or specifically reviewed for their content.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.it.northwestern.edu/about/it-projects/dei/glossary.html&quot;&gt;Inclusive Language in Technology (Northwestern University)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://medium.com/pm101/inclusive-language-guide-for-tech-companies-and-startups-f5b254d4a5b7&quot;&gt;Inclusive Language Guide for Tech Companies and Startups (Medium)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://pantheon.io/docs/inclusive-language&quot;&gt;Inclusive Language at Pantheon and in the Pantheon Community&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Our documentation, code, and technical literature will have fewer unintended connotations, and it will be easier to understand for all. This will reduce friction, confusion, and time clarifying concepts during our interactions.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use Type Tray to improve editorial UX</title>
    <link href="https://architecture.lullabot.com/adr/20220503-use-type-tray/" />
    <updated>2022-05-06T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220503-use-type-tray/</id>
    <summary type="html">Drupal&#39;s editorial experience in the &amp;quot;Add Content&amp;quot; page is confusing out of the box, especially when the content model&#39;s complexity increases.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="contrib-modules" scheme="https://architecture.lullabot.com/topics/" />
    <category term="editorial-experience" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;p&gt;While the greatest advantage is achieved on sites with a large number of
content types, the module still improves the usability of the &amp;quot;Add Content&amp;quot; on
smaller sites, allowing to group semantically similar content types together.&lt;/p&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Drupal sites will use &lt;a href=&quot;https://www.drupal.org/project/type_tray&quot;&gt;Type Tray&lt;/a&gt; to
enhance the usability of the &amp;quot;Add Content&amp;quot; page. Developers, strategists, and
product owners should work together to put in place categories that help the
site&#39;s editors.&lt;/p&gt;
&lt;p&gt;Additionally, it&#39;s highly recommended to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;create imagery (icons and thumbnails) to better represent each content
type in a more visual manner.&lt;/li&gt;
&lt;li&gt;produce relevant short / long descriptions that effectively help authors
when getting familiar with the content types&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;A better experience for content editors when there are several content types
on a site, and they need context about which content type to use.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use Simple Add More to improve editorial experience</title>
    <link href="https://architecture.lullabot.com/adr/20220504-use-simple-add-more/" />
    <updated>2022-05-06T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220504-use-simple-add-more/</id>
    <summary type="html">Drupal core by default outputs the maximum number of values (cardinality) as empty elements on entity forms, which usually represents a poor user-experience.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="contrib-modules" scheme="https://architecture.lullabot.com/topics/" />
    <category term="editorial-experience" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Drupal sites will use &lt;a href=&quot;https://www.drupal.org/project/sam&quot;&gt;Simple Add More&lt;/a&gt; to
enhance the usability of entity forms.&lt;/p&gt;
&lt;h3 id=&quot;considerations&quot; tabindex=&quot;-1&quot;&gt;Considerations&lt;/h3&gt;
&lt;p&gt;This is recommended on both new projects and existing sites, since it improves
the editorial UX with low effort.&lt;/p&gt;
&lt;h2 id=&quot;alternatives-considered&quot; tabindex=&quot;-1&quot;&gt;Alternatives considered&lt;/h2&gt;
&lt;p&gt;There is &lt;a href=&quot;https://www.drupal.org/project/drupal/issues/1156338&quot;&gt;a core issue&lt;/a&gt;
to provide similar functionality, using core&#39;s built-in AJAX button. This
solution using client-side JS might become obsolete when the above core issue
is fixed.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;We will provide a better editorial experience using form elements for fields that accept more than one value.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Break composer install if patches don&#39;t apply</title>
    <link href="https://architecture.lullabot.com/adr/20220429-composer-exit-failure/" />
    <updated>2022-04-29T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220429-composer-exit-failure/</id>
    <summary type="html">Allowing builds to succeed with failed patches can lead to malformed code or hidden errors.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="composer" scheme="https://architecture.lullabot.com/topics/" />
    <category term="php" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;When using &lt;a href=&quot;https://github.com/cweagans/composer-patches&quot;&gt;cweagans/composer-patches&lt;/a&gt;
1.x to manage patches, use the following configuration:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;composer-exit-on-patch-failure&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Composer Patches 2.x always stops &lt;code&gt;composer install&lt;/code&gt; when a patch fails to
apply, and no longer reads &lt;code&gt;composer-exit-on-patch-failure&lt;/code&gt;, so it needs no
configuration.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Errors related to patches will surface earlier in the development process, such as when running automated updates.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use local copies of patch files</title>
    <link href="https://architecture.lullabot.com/adr/20220429-composer-patch-files/" />
    <updated>2022-04-29T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220429-composer-patch-files/</id>
    <summary type="html">When using &lt;a href=&quot;https://github.com/cweagans/composer-patches&quot;&gt;cweagans/composer-patches&lt;/a&gt;, it is important that patch sources are consistent and do not change between builds.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="php" scheme="https://architecture.lullabot.com/topics/" />
    <category term="composer" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;When using &lt;a href=&quot;https://github.com/cweagans/composer-patches&quot;&gt;cweagans/composer-patches&lt;/a&gt;, publicly hosted patch files will be downloaded and stored in your project in a &lt;code&gt;patches&lt;/code&gt; directory. Local patch files shall be referenced in composer.json. Do not reference remote URLs to patch files in composer.json as their contents may change leading to unexpected build failures.&lt;/p&gt;
&lt;h3 id=&quot;using-a-patch-from-drupal.org&quot; tabindex=&quot;-1&quot;&gt;Using a patch from drupal.org&lt;/h3&gt;
&lt;p&gt;Download the patch and store it in the &lt;code&gt;patches/upstream/&lt;/code&gt; directory in your project.
Make sure the file name at minimum references the drupal.org issue and comment numbers.&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;drupal/replicate_actions&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;&quot;Issue #3179837: Make sure translations are replicated unpublished as well&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;patches/upstream/replicate_actions-3179837-2.patch&quot;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;use-a-local-patch-to-refer-to-a-drupal.org-merge-request-without-patches&quot; tabindex=&quot;-1&quot;&gt;Use a local patch to refer to a drupal.org Merge Request without patches&lt;/h3&gt;
&lt;p&gt;When referring to an issue that doesn&#39;t have a patch (only a Merge Request),
never use the GitLab URL with the &lt;code&gt;.patch&lt;/code&gt; suffix. Follow the
&lt;a href=&quot;https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupal/creating-issue-forks-and-merge-requests#s-downloading-a-patch-file-from-a-merge-request&quot;&gt;instructions&lt;/a&gt;
on how to create a local patch from a Merge Request, and save it in the
&lt;code&gt;patches/upstream/&lt;/code&gt; directory in your project.&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;Issue #2823541: Allow exposed filters AJAX calls to persist query params&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;patches/upstream/2823541-41-rerolled-on-9.2.7.patch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;use-local-patches-for-project-specific-modifications&quot; tabindex=&quot;-1&quot;&gt;Use local patches for project-specific modifications&lt;/h3&gt;
&lt;p&gt;When a patch is needed but it can&#39;t be contributed back because it&#39;s too
specific to the project, store the patch in the &lt;code&gt;patches/local/&lt;/code&gt; directory:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;Redirect users to the document library after creating documents&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;patches/local/redirect-to-doc-library.patch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Upstream changes to in-development patches will not be automatically applied to projects. It&#39;s possible that inherited projects or external teams expect this behaviour. However, given the stability and security issues inherent in such an approach, we will update project processes and Composer configuration to match this ADR.&lt;/p&gt;
&lt;p&gt;An additional benefit of storing patches in the repository, is that both new patches and changes to existing patches are visible directly in the PR diff, allowing reviewers to inspect the patch content itself, without manually generating interdiffs.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Store Composer Patches configuration in composer.json</title>
    <link href="https://architecture.lullabot.com/adr/20220429-composer-patches-inline/" />
    <updated>2022-04-29T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220429-composer-patches-inline/</id>
    <summary type="html">Validating a complete Composer configuration is important to ensuring build issues are caught early.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="php" scheme="https://architecture.lullabot.com/topics/" />
    <category term="composer" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h1 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h1&gt;
&lt;p&gt;When using &lt;a href=&quot;https://github.com/cweagans/composer-patches&quot;&gt;cweagans/composer-patches&lt;/a&gt;, patches will be specified in &lt;code&gt;composer.json&lt;/code&gt; and not &lt;code&gt;composer.patches.json&lt;/code&gt;. We will not use the &lt;code&gt;patches-file&lt;/code&gt; configuration key. This ensures that &lt;code&gt;composer validate&lt;/code&gt; lints the entire Composer configuration, including patches.&lt;/p&gt;
&lt;h1 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h1&gt;
&lt;p&gt;Projects that have a separate patches file will need to inline their configuration. Given the clear benefits in having a valid Composer configuration, we view this as worthwhile for all existing and inherited projects.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Configure Composer Patches to Use `-p2` as `patchLevel` for Drupal core</title>
    <link href="https://architecture.lullabot.com/adr/20220429-composer-patchlevel/" />
    <updated>2022-04-29T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220429-composer-patchlevel/</id>
    <summary type="html">Drupal&#39;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.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="php" scheme="https://architecture.lullabot.com/topics/" />
    <category term="composer" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;When using &lt;a href=&quot;https://github.com/cweagans/composer-patches&quot;&gt;cweagans/composer-patches&lt;/a&gt; 1.x, the following configuration will be used:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;patchLevel&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;&quot;drupal/core&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-p2&quot;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Composer Patches 2.x applies patches to &lt;code&gt;drupal/core&lt;/code&gt; at &lt;code&gt;-p2&lt;/code&gt; by default and
no longer reads &lt;code&gt;patchLevel&lt;/code&gt;, so it needs no configuration. To set the patch
depth for another package, use its
&lt;a href=&quot;https://github.com/cweagans/composer-patches/blob/main/docs/usage/configuration.md&quot;&gt;&lt;code&gt;package-depths&lt;/code&gt;&lt;/a&gt;
setting.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Errors due to misapplied patches will be reduced.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use dedicated accounts for service integrations</title>
    <link href="https://architecture.lullabot.com/adr/20220426-use-dedicated-accounts-service-integrations/" />
    <updated>2022-04-26T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220426-use-dedicated-accounts-service-integrations/</id>
    <summary type="html">Service integrations that use personal accounts tie the function of the service with the person&#39;s engagement with the project.</summary>
    <category term="devops" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;!-- Here begins Markdown and HTML --&gt;
&lt;p&gt;Tying the normal operation of services to a person&#39;s engagement makes it more difficult for developers to roll off from
a project successfully. It also increases risk of breaking the client&#39;s service integrations when developers don&#39;t
remember to transition the integrations to another account.&lt;/p&gt;
&lt;p&gt;Examples of these services include: GitHub, Circle CI, Tugboat, Jira, and Slack.&lt;/p&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;!-- Write the decision here --&gt;
&lt;!-- Headings will be shown in a table of contents with links --&gt;
&lt;p&gt;When integrating services together always use a dedicated account for the integration credentials instead of a person&#39;s
individual account.&lt;/p&gt;
&lt;h3 id=&quot;implementation&quot; tabindex=&quot;-1&quot;&gt;Implementation&lt;/h3&gt;
&lt;p&gt;Depending on the client, valid implementations include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A dedicated email address and account per project or service, with credentials stored in a shared password manager. This e-mail address should be owned by the client i.e. not an &lt;code&gt;@lullabot.com&lt;/code&gt; address.&lt;/li&gt;
&lt;li&gt;A Slack email address (this can be obtained by going to &lt;code&gt;Channel Details / Integrations&lt;/code&gt;). Again, this should be an e-mail address owned by the client that won&#39;t disappear when Lullabot rolls off the project.&lt;/li&gt;
&lt;li&gt;For services that support it, a project access token (instead of a personal access token).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Don&#39;t use account aliases to register multiple bots for the same service like &lt;code&gt;projectname+ted.lasso@lullabot.com&lt;/code&gt;, as spam filtering on the service side is likely to block account creation.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;!-- What has to be done now that we&#39;ve made the decision? --&gt;
&lt;!-- How will this impact us or our clients? --&gt;
&lt;p&gt;Rolling off a person will not have a side-effect on continued operations. Automated actions in service integrations will
not seem like they are performed by a person.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Always hide non-translatable fields on translation forms</title>
    <link href="https://architecture.lullabot.com/adr/20220425-hide-untranslatable-fields/" />
    <updated>2022-04-25T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220425-hide-untranslatable-fields/</id>
    <summary type="html">When content translation is enabled, it&#39;s possible to decide which fields can be translated.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;p&gt;By default, Drupal displays both translatable and non-translatable field on translation forms. This often leads to
editors changing values of a non-translatable field when translating content and inadvertently affecting all other
translations as well.&lt;/p&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;When configuring field translatability in Drupal, all non-translatable fields should be hidden from the translation
forms.&lt;/p&gt;
&lt;h3 id=&quot;how-to-do-it&quot; tabindex=&quot;-1&quot;&gt;How to do it&lt;/h3&gt;
&lt;p&gt;Navigate to &lt;em&gt;Configuration -&amp;gt; Regional and Language -&amp;gt; Content language and translation&lt;/em&gt; and make sure to check the
corresponding checkbox on each translatable bundle:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://architecture.lullabot.com/assets/images/adrs/hide-non-translatable-fields.png&quot; alt=&quot;Screenshot showing &amp;quot;Hide non translatable fields on translation forms checked off&amp;quot;&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Projects will reduce changes of editorial confusion when translating content in Drupal.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Lock entity language on edit forms</title>
    <link href="https://architecture.lullabot.com/adr/20220320-prevent-language-change/" />
    <updated>2022-03-20T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220320-prevent-language-change/</id>
    <summary type="html">Editors new to Drupal often try to translate content by changing the language on existing content, causing confusion for site visitors.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Projects where Content Translation is enabled will use the following configuration when setting up translatability of content entities:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Step 1: Expose Language selector on entity forms:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Navigate to &lt;em&gt;Configuration -&amp;gt; Regional and Language -&amp;gt; Content language and translation&lt;/em&gt; and check &amp;quot;Show language selector on create and edit pages&amp;quot;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Step 2: Use a form alter in custom code to prevent it from being changed when the entity is being edited. This can be accomplished with code similar to the one below:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/**
 * Implements hook_form_BASE_FORM_ID_alter() for node_form.
 */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function-definition function&quot;&gt;mymodule_form_node_form_alter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name type-declaration&quot;&gt;FormStateInterface&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$form_state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$form_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;/** @var &#92;Drupal&#92;node&#92;NodeInterface $node */&lt;/span&gt;
  &lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$form_state&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getFormObject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getEntity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;// Disable the language dropdown if this is an edit operation.&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$node&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;isNew&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;langcode&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;widget&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;value&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;langcode&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;widget&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;value&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#disabled&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;TRUE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It&#39;s possible this behavior changes in the future, below are a few feature requests to change this in Drupal core:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.drupal.org/project/drupal/issues/2986823&quot;&gt;https://www.drupal.org/project/drupal/issues/2986823&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.drupal.org/project/drupal/issues/2860826&quot;&gt;https://www.drupal.org/project/drupal/issues/2860826&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;We will reduce chances of editors inadvertently changing the language of existing content when they intend to create a new translation.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Consistently name entity fields</title>
    <link href="https://architecture.lullabot.com/adr/20220208-naming-fields/" />
    <updated>2022-02-08T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220208-naming-fields/</id>
    <summary type="html">Adopting a consistent set of rules when naming entities in Drupal can reduce errors and improve maintainability.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Use English when creating non-visitor-facing names. Adopt US-English spelling (e.g. &amp;quot;color&amp;quot; instead of &amp;quot;colour&amp;quot;).&lt;/p&gt;
&lt;p&gt;Try keeping visitor-facing labels and their corresponding machine names as similar as possible (ideally identical).&lt;/p&gt;
&lt;p&gt;When naming fields, use one of the two formats below:&lt;/p&gt;
&lt;h3 id=&quot;1--on-non-reusable-fields&quot; tabindex=&quot;-1&quot;&gt;1- On non-reusable fields&lt;/h3&gt;
&lt;p&gt;Use the format &lt;code&gt;field_{bundle}__{name}&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For example: &lt;code&gt;field_customer__logo&lt;/code&gt; or &lt;code&gt;field_image__caption&lt;/code&gt; .&lt;/li&gt;
&lt;li&gt;Use underscores &lt;code&gt;_&lt;/code&gt; to separate multi-word names ( &lt;code&gt;field_news_pr__hero_image&lt;/code&gt; )&lt;/li&gt;
&lt;li&gt;When necessary, abbreviate the field name, not the bundle.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;2--on-reusable-(shared)-fields%2C&quot; tabindex=&quot;-1&quot;&gt;2- On reusable (shared) fields,&lt;/h3&gt;
&lt;p&gt;Use the format &lt;code&gt;field_{name}&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For example: &lt;code&gt;field_categories&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Drupal fields will gain uniformity by following a consistent set of naming guidelines.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>[deprecated] Composer patches configuration and best practices</title>
    <link href="https://architecture.lullabot.com/adr/20220119-composer-patches/" />
    <updated>2022-02-07T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220119-composer-patches/</id>
    <summary type="html">Default &lt;code&gt;composer-patches&lt;/code&gt; settings can lead to misapplied patches or hidden errors. Using a consistent configuration across projects will reduce errors and save time.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="php" scheme="https://architecture.lullabot.com/topics/" />
    <category term="composer" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;p&gt;&lt;strong&gt;This ADR has been replaced&lt;/strong&gt; by multiple separate ADRs, viewable at &lt;a href=&quot;https://architecture.lullabot.com/adrs/composer&quot;&gt;ADRs tagged &amp;quot;composer&amp;quot;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When using &lt;a href=&quot;https://github.com/cweagans/composer-patches&quot;&gt;cweagans/composer-patches&lt;/a&gt;
to manage patches in a Drupal project, developers are expected to use
consistent process and configurations for managing project patches.&lt;/p&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;When using &lt;a href=&quot;https://github.com/cweagans/composer-patches&quot;&gt;cweagans/composer-patches&lt;/a&gt;
to manage patches, use the following configuration:&lt;/p&gt;
&lt;h3 id=&quot;break-install-if-patches-don&#39;t-apply&quot; tabindex=&quot;-1&quot;&gt;Break install if patches don&#39;t apply&lt;/h3&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;composer-exit-on-patch-failure&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;use--p2-as-patchlevel-for-drupal-core-patches&quot; tabindex=&quot;-1&quot;&gt;Use &lt;code&gt;-p2&lt;/code&gt; as &lt;code&gt;patchLevel&lt;/code&gt; for Drupal core patches&lt;/h3&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;patchLevel&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;&quot;drupal/core&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-p2&quot;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;specify-patches-in-a-separate-composer.patches.json-file&quot; tabindex=&quot;-1&quot;&gt;Specify patches in a separate &lt;code&gt;composer.patches.json&lt;/code&gt; file&lt;/h3&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;patches-file&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;composer.patches.json&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;use-the-patch-remote-url-when-available&quot; tabindex=&quot;-1&quot;&gt;Use the patch remote URL when available&lt;/h3&gt;
&lt;p&gt;When referring to a remote issue that has a patch on drupal.org, use the
direct URL of the patch. Make sure you start the patch description with the
issue number:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;drupal/replicate_actions&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;&quot;Issue #3179837: Make sure translations are replicated unpublished as well&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://www.drupal.org/files/issues/2020-10-30/3179837-2.patch&quot;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;use-a-local-patch-to-refer-to-a-drupal.org-merge-request-without-patches&quot; tabindex=&quot;-1&quot;&gt;Use a local patch to refer to a drupal.org Merge Request without patches&lt;/h3&gt;
&lt;p&gt;When referring to an issue that doesn&#39;t have a patch (only a Merge Request),
never use the GitLab URL with the &lt;code&gt;.patch&lt;/code&gt; suffix. Follow the
&lt;a href=&quot;https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupal/creating-issue-forks-and-merge-requests#s-downloading-a-patch-file-from-a-merge-request&quot;&gt;instructions&lt;/a&gt;
on how to create a local patch from a Merge Request, and save it in the
&lt;code&gt;patches/upstream/&lt;/code&gt; directory in your project.&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;Issue #2823541: Allow exposed filters AJAX calls to persist query params&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;patches/upstream/2823541-41-rerolled-on-9.2.7.patch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;use-local-patches-for-project-specific-modifications&quot; tabindex=&quot;-1&quot;&gt;Use local patches for project-specific modifications&lt;/h3&gt;
&lt;p&gt;When a patch is needed but it can&#39;t be contributed back because it&#39;s too
specific to the project, store the patch in the &lt;code&gt;patches/local/&lt;/code&gt; directory:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;Redirect users to the document library after creating documents&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;patches/local/redirect-to-doc-library.patch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;examples&quot; tabindex=&quot;-1&quot;&gt;Examples&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;composer.json&lt;/code&gt; :&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;extra&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token property&quot;&gt;&quot;composer-exit-on-patch-failure&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token property&quot;&gt;&quot;patchLevel&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token property&quot;&gt;&quot;drupal/core&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-p2&quot;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token property&quot;&gt;&quot;patches-file&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;composer.patches.json&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;composer.patches.json&lt;/code&gt; :&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;&quot;patches&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token property&quot;&gt;&quot;drupal/core&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token property&quot;&gt;&quot;Issue #2921627: Drupal should not use full CSS required marker in forms according to WCAG 2.0&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://www.drupal.org/files/issues/2021-08-02/2921627-63_0.patch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;token property&quot;&gt;&quot;Issue #2823541: Allow exposed filters AJAX calls to persist query params&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;patches/upstream/2823541-41-rerolled-on-9.2.7.patch&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;token property&quot;&gt;&quot;Redirect users to the document library after creating documents&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;patches/local/redirect-to-doc-library.patch&quot;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;patches/upstream/README.md&lt;/code&gt; :&lt;/p&gt;
&lt;pre class=&quot;language-markdown&quot;&gt;&lt;code class=&quot;language-markdown&quot;&gt;Store in this directory patches that are generated from GitLab Merge Requests.
Do NOT manually modify the patches that are in this directory. If any changes
or adjustments are needed, store the patch in the &lt;span class=&quot;token code-snippet code keyword&quot;&gt;`patches/local/`&lt;/span&gt; directory.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;patches/local/README.md&lt;/code&gt; :&lt;/p&gt;
&lt;pre class=&quot;language-markdown&quot;&gt;&lt;code class=&quot;language-markdown&quot;&gt;Store in this directory patches that are project-specific and not intended to
be contributed back to the community.&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Developers have a clear set of instructions on how to manage patches with
Composer in Drupal projects.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use PHPUnit for unit testing PHP code</title>
    <link href="https://architecture.lullabot.com/adr/20220207-php-unit-tests/" />
    <updated>2022-02-07T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220207-php-unit-tests/</id>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="php" scheme="https://architecture.lullabot.com/topics/" />
    <category term="coding" scheme="https://architecture.lullabot.com/topics/" />
    <category term="testing" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;p&gt;Using a testing framework like &lt;a href=&quot;https://phpunit.de&quot;&gt;PHPUnit&lt;/a&gt; in all our projects will speed up test authoring and increase reliability of our tests.&lt;/p&gt;
&lt;p&gt;PHPUnit is the most popular framework for unit testing in PHP. It is a well maintained and well documented project. Drupal and Symfony use PHPUnit for their unit tests.&lt;/p&gt;
&lt;p&gt;Other options briefly considered:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Custom classes that use the &lt;code&gt;assert&lt;/code&gt; global funtion&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://simpletest.sourceforge.net&quot;&gt;SimpleTest&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will use the PHPUnit framework when writing unit tests for PHP code.&lt;/p&gt;
&lt;p&gt;In CI, these tests will be executed using the built-in PHPUnit CLI test runner. Locally tests can be executed using the CLI or IDE integrations.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Using the same tool in all our projects will allow the team to deepen our expertise with PHPUnit, be more efficient when writing tests, and transition to other projects more easily.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Block the Drupal user 1 account in production environments</title>
    <link href="https://architecture.lullabot.com/adr/20211026-one-time-login-first-drupal-user-account/" />
    <updated>2022-01-12T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20211026-one-time-login-first-drupal-user-account/</id>
    <summary type="html">The first user account in a Drupal site (often referred to as &amp;quot;administrator&amp;quot; or &amp;quot;user 1&amp;quot;) is &lt;a href=&quot;https://www.drupal.org/docs/user_guide/en/user-admin-account.html&quot;&gt;granted every permission automatically&lt;/a&gt;. If the account credentials are compromised, an attacker can easily inject JavaScript to attack site visitors and can likely execute arbitrary PHP code.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="security" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;The Drupal admin account will be blocked on production environments. Individually named user accounts will be created and granted appropriate roles as needed. Even though users may have equivalent permissions by being granted the &amp;quot;Administrator&amp;quot; role, admin actions will be logged with the actioning user&#39;s identity.&lt;/p&gt;
&lt;p&gt;The administrator user account will be unblocked as needed for staging, development, and local environments.&lt;/p&gt;
&lt;p&gt;For example, using &lt;code&gt;drush&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-console&quot;&gt;&lt;code class=&quot;language-console&quot;&gt;drush user:unblock &lt;username&gt;&lt;/username&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In Drush 11 and newer, &lt;a href=&quot;https://github.com/drush-ops/drush/pull/4542&quot;&gt;the &lt;code&gt;--uid&lt;/code&gt; flag can be used&lt;/a&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-console&quot;&gt;&lt;code class=&quot;language-console&quot;&gt;drush user:unblock --uid=1&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Otherwise for older versions of Drush and Drupal 8 or 9, and when the admin username is unknown, it can be determined with and unblocked with a subcommand:&lt;/p&gt;
&lt;pre class=&quot;language-console&quot;&gt;&lt;code class=&quot;language-console&quot;&gt;drush user:unblock &quot;$(drush user:information --uid=1 --fields=name --format=string)&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For Drupal 7 and older versions &lt;code&gt;drush sqlq&lt;/code&gt; can be used to get the user name:&lt;/p&gt;
&lt;pre class=&quot;language-console&quot;&gt;&lt;code class=&quot;language-console&quot;&gt;drush sqlq &#39;SELECT name FROM users WHERE uid=1&#39;;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The administrator user account will have a long, random password set that is discarded. This will prevent exposing Administrator logins if the account is accidentally unblocked.&lt;/p&gt;
&lt;h2 id=&quot;disable-the-super-user-access-policy&quot; tabindex=&quot;-1&quot;&gt;Disable the super user access policy&lt;/h2&gt;
&lt;p&gt;From Drupal 10.3.0 onwards, user 1&#39;s implicit access to every permission is provided by the &lt;code&gt;SuperUserAccessPolicy&lt;/code&gt;. This should be &lt;a href=&quot;https://www.drupal.org/docs/administering-a-drupal-site/security-in-drupal/securing-the-admin-super-user-1#s-disable-the-super-user-access-policy&quot;&gt;disabled in &lt;code&gt;services.yml&lt;/code&gt;&lt;/a&gt; on all non-local environments:&lt;/p&gt;
&lt;pre class=&quot;language-yaml&quot;&gt;&lt;code class=&quot;language-yaml&quot;&gt;&lt;span class=&quot;token key atrule&quot;&gt;parameters&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;token key atrule&quot;&gt;security.enable_super_user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean important&quot;&gt;false&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After changing this parameter, rebuild the container (e.g. &lt;code&gt;drush cr&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Once disabled, ensure user 1 does not hold the &lt;code&gt;Administrator&lt;/code&gt; role, otherwise they will still have full access through that role rather than the policy.&lt;/p&gt;
&lt;p&gt;To re-enable super user access on a local environment — for example after importing a production database — set the parameter back to &lt;code&gt;true&lt;/code&gt; in the local &lt;code&gt;services.yml&lt;/code&gt; override and rebuild:&lt;/p&gt;
&lt;pre class=&quot;language-yaml&quot;&gt;&lt;code class=&quot;language-yaml&quot;&gt;&lt;span class=&quot;token key atrule&quot;&gt;parameters&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;token key atrule&quot;&gt;security.enable_super_user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean important&quot;&gt;true&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Teams may need to add a Drush command to unblock the administrator account when pulling production databases into environments like &lt;a href=&quot;https://www.tugboat.qa/&quot;&gt;Tugboat&lt;/a&gt;. Local development tools also offer ways to automatically unblock accounts with Drush after a database import.&lt;/p&gt;
&lt;p&gt;Disabling the super user policy means user 1 behaves as a regular user. This is the desired state for production, but teams must ensure at least one other account holds the &lt;code&gt;Administrator&lt;/code&gt; role before disabling it to avoid losing access.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Always use typehints in new PHP code</title>
    <link href="https://architecture.lullabot.com/adr/20220112-type-hints/" />
    <updated>2022-01-12T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20220112-type-hints/</id>
    <summary type="html">Following stricter typing where available can significantly reduce bugs, and simplify maintainability. This has been proven by several studies across different disciplines.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="php" scheme="https://architecture.lullabot.com/topics/" />
    <category term="coding" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;p&gt;See &lt;a href=&quot;https://sethmlarson.dev/blog/2021-10-18/tests-arent-enough-case-study-after-adding-types-to-urllib3&quot;&gt;Case study after adding type hints to urllib3&lt;/a&gt;, and &lt;a href=&quot;https://blog.acolyer.org/2017/09/19/to-type-or-not-to-type-quantifying-detectable-bugs-in-javascript/&quot;&gt;To type or not to type: quantifying detectable bugs in JavaScript&lt;/a&gt;. To quote the latter:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Both Flow and TypeScript are pretty good, and conservatively either of them can prevent about 15% of the bugs that end up in committed code.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will use type hints in all the new PHP code we write. According to the &lt;a href=&quot;https://www.php.net/manual/en/language.types.declarations.php&quot;&gt;official documentation&lt;/a&gt; this includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Type hints in class properties.&lt;/li&gt;
&lt;li&gt;Type hints for class method parameters and return types.&lt;/li&gt;
&lt;li&gt;Type hints for procedural function parameters and return types.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Depending on the PHP version the project uses, support may vary. All these are available in PHP 7.4 and newer.&lt;/p&gt;
&lt;h3 id=&quot;examples&quot; tabindex=&quot;-1&quot;&gt;Examples&lt;/h3&gt;
&lt;p&gt;Type hints can apply to procedural and object-oriented code.&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/**
 * Implements hook_jsonapi_entity_filter_access().
 */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function-definition function&quot;&gt;my_module_jsonapi_entity_filter_access&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name type-declaration&quot;&gt;EntityTypeInterface&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$entity_type&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name type-declaration&quot;&gt;AccountInterface&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$account&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword return-type&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note how you can implement a hook or an interface and provide return types even if the hook definition or the interface does not declare one. This is not possible with parameter arguments.&lt;/p&gt;
&lt;p&gt;From &lt;a href=&quot;https://www.php.net/manual/en/language.types.declarations.php&quot;&gt;the documentation&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When overriding a parent method, the child&#39;s method must match any return type declaration on the parent. If the parent doesn&#39;t define a return type, then the child method may do so.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The following example illustrates a PHP class with type hints.&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;declare&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;strict_types&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;token package&quot;&gt;Foo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name-definition class-name&quot;&gt;ExampleClass&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;token keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;token keyword type-declaration&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$name&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
 &lt;span class=&quot;token keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function-definition function&quot;&gt;greet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
   &lt;span class=&quot;token keyword type-hint&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$prefix&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
   &lt;span class=&quot;token class-name type-declaration&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$isGrumpy&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
   &lt;span class=&quot;token class-name type-declaration&quot;&gt;Account&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$user&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;NULL&lt;/span&gt;
 &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;token keyword return-type&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$isGrumpy&lt;/span&gt;
     &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;null&lt;/span&gt;
     &lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sprintf&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;Hello %s&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$account&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;userName&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;??&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
 &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Refer to the PHP documentation to learn more about type hints, scalar type hints, and nullable types.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;The PHP code we write will be more maintainable, and less prone to have bugs. This will lead to higher efficiency.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Confirm Drupal site configuration is always in a default state</title>
    <link href="https://architecture.lullabot.com/adr/20211212-config-status-check/" />
    <updated>2021-12-12T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20211212-config-status-check/</id>
    <summary type="html">Configuration should never be in an overridden state after configuration import(s) have been completed.</summary>
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="deployment" scheme="https://architecture.lullabot.com/topics/" />
    <category term="automation" scheme="https://architecture.lullabot.com/topics/" />
    <category term="devops" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;p&gt;When there is overridden configuration it indicates that code and database are not in sync. This creates confusion as to if a branch is safe to merge or a release is safe to deploy.&lt;/p&gt;
&lt;p&gt;Overridden configuration can be caused by module updates that alter existing configuration. These are easily overlooked when using an automated package updater like &lt;a href=&quot;https://dependabot.com/&quot;&gt;Dependabot&lt;/a&gt; or &lt;a href=&quot;https://violinist.io&quot;&gt;Violinist.io&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;After running the standard &lt;a href=&quot;https://architecture.lullabot.com/adr/20210924-drupal-build-steps/&quot;&gt;Drupal build steps&lt;/a&gt; we should
follow up with &lt;code&gt;drush config:status&lt;/code&gt; and check the results of that command for &lt;code&gt;No differences&lt;/code&gt;. If differences are
found we should fail the build.&lt;/p&gt;
&lt;p&gt;Example: &lt;code&gt;[[ $(vendor/bin/drush config:status --format=json --state=Different) == &#39;[]&#39; ]] || exit 1&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&quot;resolving-overridden-configuration-errors&quot; tabindex=&quot;-1&quot;&gt;Resolving Overridden Configuration Errors&lt;/h3&gt;
&lt;p&gt;When the above status check fails, there are several steps developers can take to attempt to fix the issue.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Double-check the config really isn&#39;t importable. Often, all that&#39;s needed is to commit missing new configuration files to the branch. Use &lt;code&gt;git status&lt;/code&gt; locally to double-check.&lt;/li&gt;
&lt;li&gt;Otherwise, start a new temporary branch from the latest commit on the &lt;code&gt;main&lt;/code&gt; branch.&lt;/li&gt;
&lt;li&gt;Refresh the local database with the latest copy from production or whatever the upstream source is.&lt;/li&gt;
&lt;li&gt;Run the build steps.&lt;/li&gt;
&lt;li&gt;Copy the changes from the original branch to the new branch. &lt;code&gt;git cherry-pick&lt;/code&gt; is helpful here.&lt;/li&gt;
&lt;li&gt;Import the config with &lt;code&gt;drush config:import&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Verify there are no changes to export with &lt;code&gt;drush config:status&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If differences still show, there may be a bug in a module or in custom code.&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;Roll back your changes to the last commit on main and re-import configuration.&lt;/li&gt;
&lt;li&gt;Recreate the configuration changes step-by-step, importing and exporting each time until the issue is found.&lt;/li&gt;
&lt;li&gt;Once found, file a bug ticket in the site project, or in the appropriate upstream project.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;When configuration status checks fail, developers will need to determine how to resolve the error, which often might be as simple as re-exporting configuration and committing the changes.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If a module was updated and introduced new configuration, a developer will need to re-export configuration to capture the changes.&lt;/li&gt;
&lt;li&gt;If a developer missed adding configuration changes to their pull request, they will need to re-create and export the configuration locally and push again.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Use DDEV for local environments</title>
    <link href="https://architecture.lullabot.com/adr/20211207-ddev-locals/" />
    <updated>2021-12-07T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20211207-ddev-locals/</id>
    <summary type="html">The software development industry is continuing to move to containers both for production and local environments. It&#39;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.</summary>
    <category term="dev-tools" scheme="https://architecture.lullabot.com/topics/" />
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="devops" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;p&gt;We would like to reduce onboarding time and leverage shared knowledge to improve the local development environment experience for our team.&lt;/p&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Projects will use &lt;a href=&quot;https://github.com/drud/ddev/&quot;&gt;ddev&lt;/a&gt; as their default local development environment. Each project will have &lt;code&gt;.ddev/config.yaml&lt;/code&gt; and related files committed to the project repository.&lt;/p&gt;
&lt;p&gt;Alternatives considered include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://lando.dev&quot;&gt;Lando&lt;/a&gt;: While functional and with broad community support, we&#39;ve experienced performance issues with this tool.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://vagrantup.com&quot;&gt;Vagrant&lt;/a&gt;: Oracle&#39;s VirtualBox is not ported to Apple Silicon, and Vagrant requires additional tooling to support containers. Other providers do not have significant community support.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.mamp.info/&quot;&gt;MAMP&lt;/a&gt;: MAMP does not run with containers and is difficult to have consistent environments across a team.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Existing projects may already have an alternate tool configured. In those cases, we will only switch the local environment to DDEV if the development team desires it, or if there is a clear point to make the change, such as when onboarding on a new team.&lt;/p&gt;
&lt;p&gt;As well, clients may specify an alternate tool for local environments that they prefer. In those cases, we will recommend ddev, but defer to their preferences.&lt;/p&gt;
&lt;p&gt;macOS users will need to use a tool like &lt;a href=&quot;https://github.com/abiosoft/colima&quot;&gt;colima&lt;/a&gt; or &lt;a href=&quot;https://www.docker.com/products/docker-desktop&quot;&gt;Docker Desktop&lt;/a&gt; to run containers. Windows users can install the Linux version of Docker inside of &lt;a href=&quot;https://docs.microsoft.com/en-us/windows/wsl/install&quot;&gt;WSL&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;All macOS users should enable &lt;a href=&quot;https://ddev.readthedocs.io/en/stable/users/install/performance/#mutagen&quot;&gt;mutagen&lt;/a&gt; for code syncing (and be aware of the &lt;a href=&quot;https://ddev.readthedocs.io/en/stable/users/install/performance/#mutagen-integration-caveats&quot;&gt;caveats&lt;/a&gt;) as it offers near-native performance that is an order of magnitude faster than Docker Desktop or sshfs mounts.&lt;/p&gt;
&lt;p&gt;Automated tests will assume ddev is available for running tests locally. For example, functional tests may assume ddev-specific configuration such as browser containers, instead of allowing deep customization for individual local environments.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use strict types in PHP code</title>
    <link href="https://architecture.lullabot.com/adr/20211201-use-strict-types-in-php-code/" />
    <updated>2021-12-01T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20211201-use-strict-types-in-php-code/</id>
    <summary type="html">PHP&#39;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 &lt;a href=&quot;https://sethmlarson.dev/blog/2021-10-18/tests-arent-enough-case-study-after-adding-types-to-urllib3&quot;&gt;Python&#39;s urllib3 type hinting case study&lt;/a&gt;.</summary>
    <category term="php" scheme="https://architecture.lullabot.com/topics/" />
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;All new files within an existing PHP code base will &lt;a href=&quot;https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict&quot;&gt;declare strict typing&lt;/a&gt;. All new projects will use strict typing for all PHP code.&lt;/p&gt;
&lt;p&gt;To enable strict typing, add the declaration to the first line of the file:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token php language-php&quot;&gt;&lt;span class=&quot;token delimiter important&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;declare&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;strict_types&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A continuous integration check will be created to identify missing declarations on new files. Existing projects may optionally expand this check to all modified files.&lt;/p&gt;
&lt;p&gt;Use one or more of the following examples to implement a CI check on a project.&lt;/p&gt;
&lt;h3 id=&quot;use-phpcs-to-detect-files-without-strict-types&quot; tabindex=&quot;-1&quot;&gt;Use PHPCS to detect files without strict types&lt;/h3&gt;
&lt;p&gt;Add the following sniff to the project&#39;s PHPCS configuration. Use this if your project is already using PHPCS.&lt;/p&gt;
&lt;pre class=&quot;language-xml&quot;&gt;&lt;code class=&quot;language-xml&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;rule&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;ref&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Generic.PHP.RequireStrictTypes&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;identify-all-custom-drupal-module-code-without-strict-types&quot; tabindex=&quot;-1&quot;&gt;Identify all custom Drupal module code without strict types&lt;/h3&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token function&quot;&gt;find&lt;/span&gt; web/modules/custom &lt;span class=&quot;token parameter variable&quot;&gt;-type&lt;/span&gt; f &lt;span class=&quot;token parameter variable&quot;&gt;-exec&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sh&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;head -n 1 {} &#92;
  | grep -Eq &quot;^&amp;lt;&#92;?php&quot; &amp;amp;&amp;amp; grep --files-without-match --fixed-strings &quot;declare(strict_types=1&quot; {}&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;use-phpcs-to-detect-only-changed-files-without-strict-types&quot; tabindex=&quot;-1&quot;&gt;Use PHPCS to detect only changed files without strict types&lt;/h3&gt;
&lt;p&gt;This example uses GitLab&#39;s &lt;code&gt;$CI_MERGE_REQUEST_TARGET_BRANCH_SHA&lt;/code&gt; environment variable to identify the merge target. Update as needed for the CI tool being used, or replace with &lt;code&gt;origin/main&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In &lt;code&gt;phpcs.strict_types.xml&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-xml&quot;&gt;&lt;code class=&quot;language-xml&quot;&gt;&lt;span class=&quot;token prolog&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot;?&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;ruleset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;rule&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;ref&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Generic.PHP.RequireStrictTypes&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;file&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;web/modules/custom&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;file&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;ruleset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the continuous integration check:&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; diff-tree &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
   &lt;span class=&quot;token parameter variable&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
   &lt;span class=&quot;token parameter variable&quot;&gt;-z&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
   --name-only &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
   --no-commit-id &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
   HEAD &lt;span class=&quot;token variable&quot;&gt;$CI_MERGE_REQUEST_TARGET_BRANCH_SHA&lt;/span&gt; -- web/modules/custom &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;xargs&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-0&lt;/span&gt; --no-run-if-empty vendor/bin/phpcs &lt;span class=&quot;token parameter variable&quot;&gt;--standard&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;phpcs.strict_types.xml&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;use-git-to-detect-files-without-strict-types&quot; tabindex=&quot;-1&quot;&gt;Use git to detect files without strict types&lt;/h3&gt;
&lt;p&gt;Use this if your project cannot use PHPCS.&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; diff-tree &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  &lt;span class=&quot;token parameter variable&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  &lt;span class=&quot;token parameter variable&quot;&gt;-z&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  --name-only &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  --no-commit-id &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  HEAD &lt;span class=&quot;token variable&quot;&gt;$CI_MERGE_REQUEST_TARGET_BRANCH_SHA&lt;/span&gt; -- web/modules/custom &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;xargs&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-0&lt;/span&gt; --no-run-if-empty -I&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-type&lt;/span&gt; f &lt;span class=&quot;token parameter variable&quot;&gt;-exec&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sh&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;head -n1 {} &#92;
    | grep -Eq &quot;^&amp;lt;&#92;?php&quot; &amp;amp;&amp;amp; grep --files-without-match --fixed-strings &quot;declare(strict_types=1&quot; {}&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Strict typing changes an implict behaviour to an explicit decision made by the developer. The declaration may seem unneeded in files that do not have any scalar types declared in called function or methods. However, since scalar types may be added at any point in the future, the benefits outweigh the risks.&lt;/p&gt;
&lt;p&gt;Developers should consider configuring their IDE to declare strict typing on new files. &lt;a href=&quot;https://www.jetbrains.com/help/phpstorm/using-file-and-code-templates.html&quot;&gt;File templates&lt;/a&gt; are a good solution for PHPStorm, and &lt;a href=&quot;https://code.visualstudio.com/docs/editor/userdefinedsnippets&quot;&gt;Snippets&lt;/a&gt; can be configured in Visual Studio Code.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Stage File Proxy for static files</title>
    <link href="https://architecture.lullabot.com/adr/20210729-stage-file-proxy/" />
    <updated>2021-10-26T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20210729-stage-file-proxy/</id>
    <summary type="html">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.</summary>
    <category term="devops" scheme="https://architecture.lullabot.com/topics/" />
    <category term="locals" scheme="https://architecture.lullabot.com/topics/" />
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <category term="contrib-modules" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Drupal sites will use &lt;a href=&quot;https://www.drupal.org/project/stage_file_proxy&quot;&gt;Stage File Proxy&lt;/a&gt; to automatically download files on-demand to each environment.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Custom code and update hooks may assume that a file is on disk, and not call the right methods to ensure that Stage File Proxy has a chance to download the image first. In those cases, the code is not using Drupal&#39;s API properly and should be treated as a bug to fix. &lt;a href=&quot;https://www.drupal.org/project/consumer_image_styles/issues/3145608&quot;&gt;#3145608: Include derivative links although the image doesn&#39;t exist (for compatibility with stage_file_proxy)&lt;/a&gt; in Consumer Image Styles has an example of the type of bug that may be surfaced.&lt;/p&gt;
&lt;p&gt;Initial page loads may be slower as images are downloaded locally. Front-end performance testing should ensure that images have been loaded before any profiles are recorded.&lt;/p&gt;
&lt;p&gt;Stage File Proxy &lt;a href=&quot;https://www.drupal.org/project/stage_file_proxy/issues/2879046&quot;&gt;does not support private files&lt;/a&gt;. If a site relies heavily on private file uploads, Stage File Proxy may not be appropriate. Very few Lullabot clients use private files, so this is unlikely to come up in practice.&lt;/p&gt;
&lt;h2 id=&quot;example-implementation&quot; tabindex=&quot;-1&quot;&gt;Example Implementation&lt;/h2&gt;
&lt;p&gt;Place the following in &lt;code&gt;settings.php&lt;/code&gt; for local, development, and continuous integration environments:&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token php language-php&quot;&gt;&lt;span class=&quot;token delimiter important&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Documentation for Stage File Proxy configuration options.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// @see https://git.drupalcode.org/project/stage_file_proxy/-/blob/HEAD/INSTALL.md#configuration&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;stage_file_proxy.settings&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;origin&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;https://www.example.com&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Transfer the remote file to the local machine.&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;stage_file_proxy.settings&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;hotlink&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;FALSE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Request original image when using image styles.&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;stage_file_proxy.settings&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;use_imagecache_root&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;TRUE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In early development, a production URL for assets may not exist. In that case, consider setting &lt;code&gt;$config[&#39;stage_file_proxy.settings&#39;][&#39;origin&#39;]&lt;/code&gt; to an upstream development server.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$config[&#39;stage_file_proxy.settings&#39;][&#39;hotlink&#39;]&lt;/code&gt; is not recommended. If the image changes, is deleted, or the environment is unavailable, it can be tricky to determine if the problem is a bug in locally changed code or the remote server.&lt;/p&gt;
&lt;p&gt;Sometimes sites inherited from other teams or companies do not have a consistent origin to serve from. In those cases, consider omitting the &lt;code&gt;stage_file_proxy_origin&lt;/code&gt; setting, and configuring it in the UI by hand.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Use settings.php for environment overrides and local settings</title>
    <link href="https://architecture.lullabot.com/adr/20211026-use-settings-not-splits/" />
    <updated>2021-10-26T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20211026-use-settings-not-splits/</id>
    <summary type="html">When developing a Drupal website, additional modules and configuration are useful for local and development environments.</summary>
    <category term="dev-tools" scheme="https://architecture.lullabot.com/topics/" />
    <category term="drupal" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;p&gt;Some teams try to leverage Config Split as a general purpose &amp;quot;override&amp;quot; tool for configuration. The presence of Config Split in the repository often leads teams to use it in production improperly, causing maintenance and development issues.&lt;/p&gt;
&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;Drupal projects will use the following techniques for managing environment-specific configuration:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Environment-specific settings files will be named &lt;code&gt;settings.ENVIRONMENT.php&lt;/code&gt; and conditionally included.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;config_exclude_modules&lt;/code&gt; will be used for &lt;a href=&quot;https://www.drupal.org/node/3079028&quot;&gt;enabling modules on development sites&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.drupal.org/project/config_ignore&quot;&gt;Config Ignore&lt;/a&gt; will be used to ignore individual configuration objects.&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.drupal.org/project/webform_config_ignore&quot;&gt;Webform Config Ignore&lt;/a&gt; is also acceptable for sites only needing to ignore Webform configuration.&lt;/li&gt;
&lt;/ul&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://www.drupal.org/project/config_split&quot;&gt;Config Split&lt;/a&gt; will not be used for environment specific overrides.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.drupal.org/project/config_pages&quot;&gt;Config Pages&lt;/a&gt; will be used to store settings which should be preserved upon a configuration import, while providing a well organized UI to users.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Examples of environment-specific configuration include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Enabling the &lt;a href=&quot;https://www.drupal.org/project/devel&quot;&gt;Devel&lt;/a&gt; module.&lt;/li&gt;
&lt;li&gt;Enabling the database logging (&lt;code&gt;dblog&lt;/code&gt;) module.&lt;/li&gt;
&lt;li&gt;Setting the default Drupal log level to &amp;quot;verbose&amp;quot;.&lt;/li&gt;
&lt;li&gt;Enabling admin-only user interface modules like Field UI and Views UI.&lt;/li&gt;
&lt;li&gt;Enabling &lt;a href=&quot;https://www.drupal.org/project/stage_file_proxy&quot;&gt;Stage File Proxy&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Provide an UI to configure external API credentials (with Config Pages).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;While not recommended by Lullabot, projects that are only storing configuration in the database can use &lt;a href=&quot;https://www.drush.org/latest/commands/config_import/&quot;&gt;&lt;code&gt;drush config:import --partial --source&lt;/code&gt;&lt;/a&gt; to import development configuration to an environment during a deployment.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;A standard way to manage and configure these tools will simplify project onboarding and debugging. However, some projects may already have a different method of managing development configuration, such as Configuration Split. In those cases, we only recommend refactoring to remove Config Split along side another significant change, such as entering the maintenance phase of a project or during a major Drupal version upgrade.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Avoid command aliases and short options</title>
    <link href="https://architecture.lullabot.com/adr/20211006-avoid-command-aliases/" />
    <updated>2021-10-06T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20211006-avoid-command-aliases/</id>
    <summary type="html">When writing scripts for CI tasks or local procedures, it is helpful to have the full command spelled out. Having the long options and avoiding command aliases will reduce chances of misinterpretation and mistakes. This will also reduce the need for checking the documentation while reading or reviewing a script.</summary>
    <category term="scripting" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will use the long form of command names and their options when writing
scripts shared with the team.&lt;/p&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;We will write &lt;code&gt;drush config:status&lt;/code&gt; and not &lt;code&gt;drush cst&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;We will write &lt;code&gt;cut --delimiter=&#39; &#39; --fields=1,4 --only-delimited&lt;/code&gt; and not
&lt;code&gt;cut -sd&#39; &#39; -f1,4&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;We will write &lt;code&gt;git checkout&lt;/code&gt; and not &lt;code&gt;git co&lt;/code&gt; or &lt;code&gt;gco&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Developers have a clear understanding of the intent of the script their are
reading.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>[deprecated] Define the order of steps when building a Drupal site</title>
    <link href="https://architecture.lullabot.com/adr/20210924-drupal-build-steps/" />
    <updated>2021-09-24T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20210924-drupal-build-steps/</id>
    <summary type="html">When updating Drupal code and configuration in a given environment, it&#39;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.</summary>
    <category term="drush" scheme="https://architecture.lullabot.com/topics/" />
    <category term="deployments" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;This ADR has been replaced&lt;/strong&gt; &lt;a href=&quot;https://architecture.lullabot.com/adr/20230929-drupal-build-steps&quot;&gt;by this new version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We standardize the build steps as:&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;vendor/bin/drush cache:clear plugin &lt;span class=&quot;token parameter variable&quot;&gt;-y&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Run numbered module updates (hook_update_N) only.&lt;/span&gt;
vendor/bin/drush updatedb --no-post-updates &lt;span class=&quot;token parameter variable&quot;&gt;-y&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Run config:import twice to make sure we catch any config that didn&#39;t declare&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# a dependency correctly. This is also useful when importing large config sets&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# as it can sometimes hit an out of memory error.&lt;/span&gt;
vendor/bin/drush config:import &lt;span class=&quot;token parameter variable&quot;&gt;-y&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;
vendor/bin/drush config:import &lt;span class=&quot;token parameter variable&quot;&gt;-y&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Run updatedb again for updates dependent on config changes&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# This second run should fire all hook_post_update_NAME() hooks.&lt;/span&gt;
vendor/bin/drush updatedb --no-cache-clear &lt;span class=&quot;token parameter variable&quot;&gt;-y&lt;/span&gt;
vendor/bin/drush cache:rebuild &lt;span class=&quot;token parameter variable&quot;&gt;-y&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Developers should write update hooks using these guidelines:&lt;/p&gt;
&lt;h3 id=&quot;hook_update_n()&quot; tabindex=&quot;-1&quot;&gt;&lt;a href=&quot;https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!module.api.php/function/hook_update_N&quot;&gt;&lt;code&gt;HOOK_update_N()&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Code that does not rely on any Drupal APIs, usually to perform direct database
queries.&lt;/p&gt;
&lt;p&gt;These hooks are the first ones to be executed, before configuration is imported.&lt;/p&gt;
&lt;h3 id=&quot;hook_post_update_name()&quot; tabindex=&quot;-1&quot;&gt;&lt;a href=&quot;https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!module.api.php/function/hook_post_update_NAME&quot;&gt;&lt;code&gt;HOOK_post_update_NAME()&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;These are called when Drupal is fully bootstrapped and all Drupal APIs are
safe to use.&lt;/p&gt;
&lt;p&gt;Using the approach outlined above with two &lt;code&gt;drush updatedb&lt;/code&gt; executions,
implementations of this hook will be executed &lt;em&gt;after&lt;/em&gt; configuration is imported,
so developers are able to rely on new config being available when it&#39;s executed.&lt;/p&gt;
&lt;h3 id=&quot;limitations&quot; tabindex=&quot;-1&quot;&gt;Limitations&lt;/h3&gt;
&lt;p&gt;At time of writing, there is at least one scenario where the steps above could
cause issues in deployments. When a deployment includes a module being
enabled (through config changes in &lt;code&gt;core.extension.yml&lt;/code&gt;) and it has a weight
different than 0, the detection of post_update hooks in the second execution
of &lt;code&gt;drush updatedb&lt;/code&gt; doesn&#39;t work.&lt;/p&gt;
&lt;p&gt;When using the order of operations described in this ADR, try to avoid
deployments that contain new modules with weight greater than 0 and post_update
hooks, even if these hooks are implemented in unrelated modules.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Developers have a clear and consistent guide to use update hooks among
projects.&lt;/li&gt;
&lt;li&gt;Automation can be built to ensure these steps are executed consistently.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Environment Indicator</title>
    <link href="https://architecture.lullabot.com/adr/20210609-environment-indicator/" />
    <updated>2021-07-23T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20210609-environment-indicator/</id>
    <summary type="html">All Drupal websites our team works on have one or more environments. At a minimum, there will be a production and a local development environment. Most projects will have production, staging, development preview, and local environments. Developers and QA often access different environments at the same time. Since making content or configuration changes on the wrong environment can have unintended consequences, it is important to be able to distinguish environments easily.</summary>
    <category term="contrib-modules" scheme="https://architecture.lullabot.com/topics/" />
    <category term="editorial-experience" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;All client sites will have the &lt;a href=&quot;https://www.drupal.org/project/environment_indicator&quot;&gt;Environment Indicator&lt;/a&gt; module installed and configured.&lt;/p&gt;
&lt;p&gt;Environment colors will be configured as follows:&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
  &lt;tr&gt;
    &lt;td&gt;Environment&lt;/td&gt;
    &lt;td&gt;Colors&lt;/td&gt;
    &lt;td&gt;Suggested &lt;code&gt;fg_color&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;Suggested &lt;code&gt;bg_color&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
  &lt;tr&gt;
    &lt;td&gt;Live&lt;/td&gt;
    &lt;td&gt;White on Red&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;#fff&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;span style=&quot;color: #e7131a;&quot;&gt;█&lt;/span&gt; &lt;code&gt;#e7131a&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Staging&lt;/td&gt;
    &lt;td&gt;White on Orange&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;#fff&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;span style=&quot;color: #b85c00&quot;&gt;█&lt;/span&gt; &lt;code&gt;#b85c00&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Development&lt;/td&gt;
    &lt;td&gt;White on Green&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;#fff&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;span style=&quot;color: #307b24&quot;&gt;█&lt;/span&gt; &lt;code&gt;#307b24&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Branch Preview&lt;/td&gt;
    &lt;td&gt;White on Blue&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;#fff&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;span style=&quot;color: #20688C&quot;&gt;█&lt;/span&gt; &lt;code&gt;#20688C&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Local&lt;/td&gt;
    &lt;td&gt;White on Grey&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;#fff&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;span style=&quot;color: #505050&quot;&gt;█&lt;/span&gt; &lt;code&gt;#505050&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;Errors will be reduced as all screenshots by authenticated users will indicate the environment. Standard environment colors may conflict with existing site configuration, so each team will need to decide if colors should be changed on existing sites or not. Sites with blue / green deployments will need to determine their own color scheme. Teams deviating from the recommended colours will need to check the accessibility of their custom colors.&lt;/p&gt;
&lt;h2 id=&quot;example-implementation&quot; tabindex=&quot;-1&quot;&gt;Example Implementation&lt;/h2&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token php language-php&quot;&gt;&lt;span class=&quot;token delimiter important&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Environment indicator.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// See: https://pantheon.io/docs/environment-indicator#d8tab-id&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$_ENV&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;PANTHEON_ENVIRONMENT&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$_ENV&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;PANTHEON_ENVIRONMENT&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;dev&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;Dev&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;// Green-ish background.&lt;/span&gt;
      &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;bg_color&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#307b24&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;// White text.&lt;/span&gt;
      &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;fg_color&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#fff&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;test&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;Test&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;// Orange-ish background.&lt;/span&gt;
      &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;bg_color&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#b85c00&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;// White text.&lt;/span&gt;
      &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;fg_color&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#fff&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;live&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;Live&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;// Red-ish background.&lt;/span&gt;
      &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;bg_color&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#e7131a&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;// White text.&lt;/span&gt;
      &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;fg_color&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#fff&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;Multidev&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;// Blue background.&lt;/span&gt;
      &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;bg_color&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#20688c&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;// White text.&lt;/span&gt;
      &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;fg_color&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#fff&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Replace this with however locals are detected.&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getenv&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;IS_DDEV_PROJECT&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;true&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;Local&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;// Grey-ish background.&lt;/span&gt;
  &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;bg_color&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#505050&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;// White text.&lt;/span&gt;
  &lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;environment_indicator.indicator&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;fg_color&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;#fff&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>
  <entry>
    <title>[deprecated] Use Log4brains to manage the ADRs</title>
    <link href="https://architecture.lullabot.com/adr/20210705-use-log4brains-to-manage-the-adrs/" />
    <updated>2021-07-04T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20210705-use-log4brains-to-manage-the-adrs/</id>
    <category term="dev-tools" scheme="https://architecture.lullabot.com/topics/" />
    <category term="doc" scheme="https://architecture.lullabot.com/topics/" />
    <category term="meta" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;p&gt;&lt;em&gt;Replaced by &lt;a href=&quot;https://architecture.lullabot.com/adr/20220621-gatsby-theme-adr/&quot;&gt;Use gatsby-theme-adr to manage the ADRs&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id=&quot;context-and-problem-statement&quot; tabindex=&quot;-1&quot;&gt;Context and Problem Statement&lt;/h2&gt;
&lt;p&gt;We want to record architectural decisions made in this project.
Which tool(s) should we use to manage these records?&lt;/p&gt;
&lt;h2 id=&quot;considered-options&quot; tabindex=&quot;-1&quot;&gt;Considered Options&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/thomvaill/log4brains&quot;&gt;Log4brains&lt;/a&gt;: architecture knowledge base (command-line + static site generator)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/npryce/adr-tools&quot;&gt;ADR Tools&lt;/a&gt;: command-line to create ADRs&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bitbucket.org/tinkerer_/adr-tools-python/src/master/&quot;&gt;ADR Tools Python&lt;/a&gt;: command-line to create ADRs&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/mrwilson/adr-viewer&quot;&gt;adr-viewer&lt;/a&gt;: static site generator&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://adr.github.io/adr-log/&quot;&gt;adr-log&lt;/a&gt;: command-line to create a TOC of ADRs&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;decision-outcome&quot; tabindex=&quot;-1&quot;&gt;Decision Outcome&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://architecture.lullabot.com/assets/images/adrs/Log4brains-logo-full.png&quot; alt=&quot;Log4brains&quot;&gt;&lt;/p&gt;
&lt;p&gt;Chosen option: &amp;quot;Log4brains&amp;quot;, because it includes the features of all the other tools, and even more.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Record architecture decisions</title>
    <link href="https://architecture.lullabot.com/adr/20210608-record-architecture-decisions/" />
    <updated>2021-06-08T00:00:00Z</updated>
    <id>https://architecture.lullabot.com/adr/20210608-record-architecture-decisions/</id>
    <summary type="html">We need to record the architectural decisions made on this project.</summary>
    <category term="meta" scheme="https://architecture.lullabot.com/topics/" />
    <content type="html">&lt;h2 id=&quot;decision&quot; tabindex=&quot;-1&quot;&gt;Decision&lt;/h2&gt;
&lt;p&gt;We will use Architecture Decision Records, as &lt;a href=&quot;http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions&quot;&gt;described by Michael Nygard&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;consequences&quot; tabindex=&quot;-1&quot;&gt;Consequences&lt;/h2&gt;
&lt;p&gt;See Michael Nygard&#39;s article, linked above. For a lightweight ADR toolset, see Nat Pryce&#39;s &lt;a href=&quot;https://github.com/npryce/adr-tools&quot;&gt;adr-tools&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
</feed>
