ModerationHandler is both a base class and @internal

Created on 8 April 2022, about 3 years ago
Updated 21 May 2025, 13 days ago

Problem/Motivation

The docblock on the Drupal\content_moderation\Entity\Handler\ModerationHandler is a bit confusing. It claims "this class is intended primarily as a base class" and in the same breath is tagged @internal.

Both BlockContentModerationHandler and NodeModerationHandler extend it already, so why can't contributed modules? It would seem reasonable to use this as a base class for custom entities. Otherwise, developers will just copy/paste the whole class into their own, and we lose one of the core benefits of OOP.

Steps to reproduce

Code inspection. Check out the docblock at core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php:14.

Proposed resolution

Remove the @internal tag from the ModerationHandler class.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

πŸ› Bug report
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

content_moderation.module

Created by

πŸ‡ΊπŸ‡ΈUnited States John Franklin

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.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    This came up as a daily BSI target

    Wasn't sure so posted in #core-development in slack

    From @godotislate

    @internal doesn't mean "can't use", it means "no BC support"

    and the interface

    **
     * Defines operations that need to vary by entity type.
     *
     * Much of the logic contained in this handler is an indication of flaws
     * in the Entity API that are insufficiently standardized between entity types.
     * Hopefully over time functionality can be removed from this interface.
     *
     * @internal
     */
    interface ModerationHandlerInterface {
    

    So believe this is a works as designed. Recommend we close this.

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

    @John Franklin, How Drupal core uses the @internal tag is explained in API definition section β†’ of the BC policy. In part, it states,

    Internal APIs
    Contributed and custom code should avoid calling internal APIs because they might change in minor releases and such changes may not be documented in change records.

    That and the previous comment resolve the question. There is no bug here, and the documentation exists, I am changing this to a support request. Also, closing because it has been answered.

Production build 0.71.5 2024