Revert adding #id to block render array

Created on 15 July 2021, about 3 years ago
Updated 14 August 2024, about 1 month ago

Problem/Motivation

Revert of #3206625: ID attribute is missing from blocks rendered by BlockFieldFormatter .

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs work

Version

1.0

Component

Code

Created by

🇨🇭Switzerland berdir Switzerland

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • 🇩🇪Germany Anybody Porta Westfalica

    I agree this makes sense, at least it should not simply use ->getMachineNameSuggestion() but maybe add a block_field prefix or suffix or something like that. Of course that's also no *real* solution, but better than predicting it's something it isn't and risking duplications.

    How to proceed here?

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 4 months ago
    7 pass
  • 🇩🇪Germany Anybody Porta Westfalica

    @Berdir: Any feedback eventually (if you should have the time)?

  • Status changed to Needs work about 2 months ago
  • 🇨🇭Switzerland berdir Switzerland

    A prefix isn't going to help. There's still going to be code that assumes #id is a block config entity and will try to load that.

    My suggestion in #2 is a separate property like #block_field_id, then you can find it if you're looking for it, although I personally don't think that is very useful because the machine name *suggestion* is a transliterated and adjusted version of the admin label and nothing that you should rely on in code.

    region is a block config entity concept, it does not exist for block_field blocks. but you could say that all block_field blocks are in a in-content pseudo region, then some kind of flag could be useful.

    I'm unsure about committing this because it's been 3 years now and even though the project isn't stable, it's still a change.

  • 🇩🇪Germany Anybody Porta Westfalica

    Thanks @Berdir I added #25 - don't have the time now to look into it deeper, especially what to use for the id attribute, but this should be a first step.

    Regarding

    although I personally don't think that is very useful because the machine name *suggestion* is a transliterated and adjusted version of the admin label and nothing that you should rely on in code.

    That's right, but in that case we needed a way to determine the right one and that was the only specific option here. Good enough for that project in other words. No general solution of course.

    How should we proceed?

Production build 0.71.5 2024