\Drupal\Core\Template\Attribute should implement Countable interface

Created on 6 May 2024, 8 months ago
Updated 8 July 2024, 6 months ago

Problem/Motivation

There are already different open issues to refactor the Attribute class. This issue is not intended to take a different direction, but I think is neither in conflict with those open issues:
- #2444003: Optimize Drupal\Core\Template\Attribute
- 📌 Create \Drupal\Component\Utility\ArrayObject Needs work
- 🐛 MarkupInterface should implement \Countable Needs work

While the issues linked above have a more ambitious target, and they don't seem to be merged soon, I'm opening this one with the single purpose of making Attribute objects countable. I'm facing this issue while working with the ui_patterns module, trying to initialize a field as an Attribute object. That scenario is causing an error because of the following code:
https://git.drupalcode.org/project/ui_patterns/-/blob/8.x-1.x/src/Elemen...

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Needs work

Version

11.0 🔥

Component
Theme 

Last updated about 1 hour ago

Created by

🇪🇸Spain akalam

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024