Undefined array key "center-top" in Drupal\acquia_dam\EmbedCodeUrlBuilder::mapImageEffects

Created on 19 February 2025, 7 months ago

Problem/Motivation

I'm getting a warning with images that use crop with the "center-top" anchor.

Undefined array key "center-top" in Drupal\acquia_dam\EmbedCodeUrlBuilder::mapImageEffects

Steps to reproduce

Enable core crop, add an image style that uses center-top as the focal point.

Proposed resolution

Should this anchor mapping match core--replace 'top' with 'center-top', 'right' with 'right-center', and 'left' with 'left-center'?

From EmbedCodeUrlBuilder.php

    $anchor_mapping = [
      'center-center' => 'c',
      'top' => 'n',
      'right-top' => 'ne',
      'right' => 'e',
      'right-bottom' => 'se',
      'bottom' => 's',
      'left-bottom' => 'sw',
      'left' => 'w',
      'left-top' => 'nw',
    ];

In core
https://api.drupal.org/api/drupal/core%21modules%21image%21src%21Plugin%...

    $form['anchor'] = [
      '#type' => 'radios',
      '#title' => $this->t('Anchor'),
      '#options' => [
        'left-top' => $this->t('Top left'),
        'center-top' => $this->t('Top center'),
        'right-top' => $this->t('Top right'),
        'left-center' => $this->t('Center left'),
        'center-center' => $this->t('Center'),
        'right-center' => $this->t('Center right'),
        'left-bottom' => $this->t('Bottom left'),
        'center-bottom' => $this->t('Bottom center'),
        'right-bottom' => $this->t('Bottom right'),
      ],
🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇺🇸United States capysara

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