Case-sensitive tokens

Created on 17 April 2025, about 2 months ago

Problem/Motivation

We have a case where we're fetching some data from an external API using the HTTP Client Manager module. The external API returns a JSON object with some arbitrary properties.

Some of these JSON properties begin with capitalized letters. For now, such properties cannot be accessed with token syntax, mainly because of the following part within TokenDecoratorTrait:

protected function normalizeKey(string $key): string {
    $key = mb_strtolower(trim($key));
    //...
}

As the key is enforced to have lowercase characters. I think we did this because we wanted to ensure consistency with Drupal's token syntax which appears to always be lowercased.

Now the question arises how we may be able to access the properties with some capitalized letters.

Steps to reproduce

Proposed resolution

In the particular case of HTTP client manager, we read out from the temporary storage in order to get the received data. The action of that module puts it into the storage as array. So when reading from the storage and put it as token in ECA, then ECA automatically converts the array into a DataTransferObject.

Currently see two options:

  1. Based on description above, we could extend the DataTransferObject to lookup property keys with a case-insensitive comparison method.
  2. Remove mb_strtolower from the normalizeKey method mentioned above.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

3.0

Component

Code

Created by

🇩🇪Germany mxh Offenburg

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024