Investigate preprocess_field in the comment module

Created on 16 July 2025, 11 days ago

Problem/Motivation

https://www.drupal.org/project/drupal/issues/3535943 πŸ“Œ Convert final 4 preprocess hooks in core modules Active

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: [PP-1] 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

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

comment.module

Created by

πŸ‡ΊπŸ‡ΈUnited States nicxvan

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