Ajax error thrown because of missing translatedMarkup

Created on 7 January 2025, 3 months ago

Problem/Motivation

Adding a media entity when creating a node and then editing the contextual crop of the entity results in an Ajax error:

TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in C:\xampp\htdocs\composer-sites\drupal11\web\core\lib\Drupal\Component\Render\FormattableMarkup.php on line 238 i Drupal\Component\Utility\Html::escape() (rad 431 av C:\xampp\htdocs\composer-sites\drupal11\web\core\lib\Drupal\Component\Utility\Html.php)

Tracking the issue it results from a missing argument in the translatable markup of the title of the contextual crop modal.

It tries to change the markup of the string "Override %entity_type in context of %bundle "%label"". However, as the node is not yet created the title of the node is empty which results in %label being NULL and leading to a TypeError.

Steps to reproduce

Would assume this is the case on multilingual sites. Have not done further testing.

Proposed resolution

Either reduce the markup and remove the use of %label or check for node creation form.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden mscweb

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