Problem/Motivation
https://www.drupal.org/project/drupal/issues/3535943
It was uncovered that the preprocess field precursors have been completed.
@mstrelan
I know we're just moving things around, but I don't think we should ignore this. The todo issue has been "fixed" for 10 years. So can we change this to use #[Hook('preprocess_field__comment')] or does that not work yet or will that never work?
@mstrelan
In fact I tested it by making the suggested change, putting a breakpoint in the method and running \Drupal\Tests\comment\Functional\CommentNonNodeTest.
Potentially we can remove the if ($element['#field_type'] == 'comment') condition as well.
@berdir
One problem is #1367354: The list of theme hook suggestions for "field" is incorrectly ordered and has namespacing collisions. This would also match all fields on a bundle named comment, as well as fields named comment, not just those of type comment
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3536196
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:
- 3536196-preprocess-field
changes, plain diff MR !12793
Comments
Comment #2
mstrelan commentedPostponed on #3535943: Convert final 4 preprocess hooks in core modules.
Comment #3
nicxvan commentedThanks!
Comment #4
mstrelan commentedBlocker is in
Comment #6
mstrelan commentedComment #7
dcam commentedI don't know that there's much to say about this change. The hook is still invoked after applying the MR. Personally, I commented out the
comment_formvariable then rebuilt the cache and it stopped being rendered. The new comment is a good one to make sure no one tries to remove that condition later thinking that it's redundant. This looks good to me.Comment #9
catchYeah good to add the comment.
After committing I realised we have two issues open dealing with these collisions. We could have added a @todo, but seems silly to revert for that, so just adding as related issues.
Committed/pushed to 11.x, thanks!
Comment #10
catchComment #12
catchThis might be the most comments trying to mark an issue fixed relative to the other comments on an issue.