Skip to main content

Resolving Twig syntax errors in Drupal

The release of Drupal 10.4.0 sees stricter validation rules being applied to Twig templates, which can result in unexpected errors after an upgrade. One such issue involves the use of regular expressions within Twig's matches operator, leading to syntax errors that can break template rendering.

This is a situation I had recently after upgrading to Drupal 10.4.0 and provides a clear resolution for the problem.

 

Navigating Docker and PHP with PECL: Trials, errors, and the eventual solution

Working with Docker can be a rewarding but occasionally frustrating experience, especially when dealing with development libraries and extensions that rely on external repositories. In this article, I’ll walk you through the trials and errors I encountered while setting up PECL and APCu in a PHP 8.2 Docker container. The process was full of lessons, dead ends, and ultimately, a working solution.

 

Resolving PHP GD library issues in Drupal

Introduction

For a while now, one persistent issue has been bugging me: a warning on Drupal's 'status report' page that reads:

GD library

library bundled (2.1.0 compatible)

Connecting AWS S3 with Docker for Drupal 10

Recently, I encountered an issue where my local Docker environment refused to connect to AWS S3, although everything worked seamlessly in AWS-managed environments. This challenge was not just a technical hurdle; it was a crucial bottleneck that needed resolution to ensure smooth Drupal deployments across various AWS environments (dev, staging and production).

How to retrieve the current menu title in Drupal – a developer’s reference

When building a theme in Drupal, it's often necessary to adapt your site’s UI dynamically based on the context in which a user is navigating. One such piece of dynamic content is the menu title. Achieving this can be a bit tricky due to the layered nature of its routing and menu systems. This reference article will walk you through the process of fetching the current menu title within the `hook_preprocess_page` function in your Drupal theme's `.theme` file.

 

Accessing nested paragraph fields in Drupal: a step-by-step reference

The issue – I have a content type that includes an entity reference revisions field named field_introduction. This field points to a paragraph, which itself contains a text field also named field_introduction, of the type Text (formatted, long). How can I access the content stored in this paragraph's field_introduction field?

Understanding and resolving a Drupal render array error

Dealing with errors in Drupal development is a common occurrence, and understanding how to interpret and resolve them is essential for smooth development workflows. In this article, we'll delve into a specific error message related to render arrays in Drupal and discuss steps to diagnose and fix the issue.

 

Best practices for configuring Twig debug settings in Drupal 10

Alright, picture this: you're knee-deep in Drupal 10 development, churning out code like a pro. But hold up, what's this? Twig debug mode is still on in production? Cue the headaches. Suddenly, your beautifully crafted HTML is drowning in unnecessary output, and innocent contact form responses are sprouting template suggestions left and right. It's a mess.

TypeError: Cannot assign null to property Drupal\views\Plugin\views\argument\ArgumentPluginBase::$operator of type string

I'm getting the following error

TypeError: Cannot assign null to property Drupal\views\Plugin\views\argument\ArgumentPluginBase::$operator of type string in Drupal\views\Plugin\views\argument\ArgumentPluginBase->unpackArgumentValue() (line 1302 of core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php).

As noted above, the relevant function is unpackArgumentValue

Subscribe to 10.x