Inline image style has incorrect 'aspect' render key.

Created on 13 January 2023, over 1 year ago
Updated 2 May 2023, about 1 year ago

Problem/Motivation

Preprocess image style contains following code:

// build an inline style to make space for the image
    if (isset($image_width) && isset($image_height)) {
      $variables['image']['aspect'] = round($image_height / $image_width * 10000) / 100 . '%';
    };

This returns following warning.

User error: "aspect" is an invalid render array key in Drupal\Core\Render\Element::children() (line 98 of /var/www/html/docroot/core/lib/Drupal/Core/Render/Element.php)

This is because the key should be preceded with a # sign.

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium mallezie Loenhout

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024