All articles

Drupal

23 articles on Drupal, each a problem from production engineering work and how it was solved.

  1. Drupal entity query date conditions on created and date fields

    created and changed store Unix timestamps; Datetime fields store UTC strings. Match the condition value to the storage type, or the filter fails silently.

  2. Don't cache failures in Next.js 16 "use cache": throw, catch outside

    A fallback returned from a "use cache" function is cached like real data. Let the cached function throw and catch the error in an uncached wrapper.

  3. Deactivate Salesforce Suite synced Drupal records instead of deleting

    Turn off push_delete, map a status field both ways with pull and push events, then deactivate in a batch: Salesforce keeps every record.

  4. Adding fetchpriority to a Drupal responsive image hero for better LCP

    Drupal's responsive image formatter has no fetchpriority setting, so add it in a theme preprocess hook for the hero style only, then fix srcset gaps and sizes.

  5. Drupal Commerce receipt emails with an empty body: service destruct order

    Receipts sent during service destruction need the theme registry, so give theme.registry the lowest needs_destruction priority to make it destruct last.

  6. Why a required Drupal media field is null in a Next.js front end

    Required is a form rule, not a read guarantee: unpublished or deleted media resolves to null, so type references as nullable and render each item defensively.

  7. Changing a Drupal field from float to decimal when it has data

    Drupal won't change a field's type once it holds data. Alter the columns, rewrite the config and update the installed schema in one update hook.

  8. Why a Drupal Views upcoming events list keeps showing past events

    Tag caching never expires a date-filtered View, because nothing is saved when time passes. Filter on end date and give the list a time-based cache.

  9. Parallel Cypress runs in Bitbucket Pipelines without Cypress Cloud

    Without a record key, give each Bitbucket parallel step every Nth spec using BITBUCKET_PARALLEL_STEP, and skip the run when its share is empty.

  10. GraphQL Compose drops text field cache tags: how to keep them

    Add each text item's processed property as a cacheable dependency in hook_graphql_compose_field_results_alter, and version image URLs by file changed time.

  11. Rebuild Drupal Pathauto aliases when a menu link moves

    Pathauto only rebuilds menu-based aliases on node save, so regenerate them from menu link and path alias hooks, queueing deep levels for cron.

  12. Serving Drupal responsive images through media view modes

    Give image media a few view modes that use the Responsive Image formatter, and render media fields as entities, so sizing is set in one place.

  13. Cleaning up a Drupal composer.json: dead patches and no-op settings

    Check every patch, flag and plugin in a Drupal composer.json against what the tool does today, remove what does nothing, and require what the root relies on.

  14. Purge Fastly after Next.js 16 revalidation, not before

    Purge the CDN inside after(), once revalidatePath has run, and purge again a few seconds later so a stale page served mid-rebuild is not kept.

  15. Fixing Salesforce JSON_PARSER_ERROR on currency fields from Drupal

    Salesforce rejects currency values like "16,000,000". Strip the formatting in a Salesforce Suite push params subscriber before the push.

  16. Fix a jQuery plugin that registers on the wrong jQuery in webpack

    Webpack can bundle a private jQuery, so a plugin registers on the wrong one. Map jquery to the page global with a function externals entry for that plugin.

  17. Show a Drupal Commerce checkout pane only for card payments

    Ajax-replaced payment radios rule out #states, so toggle the pane with a data attribute and skip its validation server-side when hidden.

  18. Reveal the Drupal tab holding an invalid required field

    Listen for the invalid event in the capture phase and focus the first invalid control's horizontal tab so browser validation stops pointing at a hidden field.

  19. Stop Drupal Views deep pager URLs from breaking Solr with a 404

    A huge ?page= value makes Views send an oversized start to Solr and return a 400; reject deep pages in hook_views_query_alter with a 404.

  20. Disabling a Drupal content type for every user, including uid 1

    Core's bypass node access shortcut skips hook_node_access, so hiding a content type from everyone means overriding the node access handler too.

  21. Next.js 16 image optimizer blocks local IPs: how to allow them safely

    Enable dangerouslyAllowLocalIP only when the image host is itself local, not on CI or NODE_ENV checks, so deployed hosts keep the private-IP guard.

  22. Exporting every image from a Drupal site as zip files with the Batch API

    Bound each Batch API request by bytes, not file count, because ZipArchive does its real work on close(); then cap archive size and clean up with cron.

  23. Making Next.js 16 tag revalidation work across several instances

    Why revalidateTag only reaches one process by default in Next.js 16, and how a shared Redis tag store fixes it for both cache layers.