Problem/Motivation

Drupal 11.4 deprecated the #item_attributes property for a number of theme elements. The deprecation-handling code prefers the newer #attributes property, setting up a situation where code using the older #item_attributes property may break, even though it is nominally still supported in Drupal 11.x.

Some of those breaks do seem to occur for Media Helper, which constructs image arrays using #item_attributes.

Steps to reproduce

Run media_helper's PHPUnit tests. Two fail because elements cannot be found by ID - the custom attribute did not make it into rendered output.

Proposed resolution

Since this is an outright break, the module should use #attributes when running on Drupal >= 11.4.

API changes

media_helper follows Drupal Core's lead in immediately adopting #attributes for image theme elements in Drupal 11.4+

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bvoynick created an issue. See original summary.

  • bvoynick committed c3da13d7 on 2.0.x
    fix: #3606366 Switch from #item_attributes to #attributes property for...
bvoynick’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

bvoynick’s picture

Issue tags: -Address deprecation of #item_attributes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.