Hardcoded field names in Core should be assigned/returned dynamically

Created on 1 May 2017, almost 8 years ago
Updated 26 April 2025, about 9 hours ago

Hardcoded field names like 'comment_forum' create many problems:

  1. They cause migration failures. Here is an example: #2853872: Migration for forum and article comments: duplicate comment types and incorrect comment_entity_statistics β†’ . I faced another scenario.
  2. They block the use case of having multiple comment fields per entity type.
  3. If the hardcoded field is removed for any reason, it can not be recreated from the Drupal interface.
  4. if the hardcoded field name is changed in future versions, other problems might happen

Proposed change:
Get the field name (names) dynamically depending on what fields the entity has.

✨ Feature request
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

comment.module

Created by

πŸ‡ΈπŸ‡ͺSweden alayham

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

Comments & Activities

Not all content is available!

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

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    The field mentioned in the issue summary, comment_forum, was removed when Forum was removed from core.

    Are there any other hard coded field names in core?

    Since we need more information to move forward with this issue, I am setting the status at Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024