Do not show content_moderation_control extra field as visible by default

Created on 27 February 2018, almost 7 years ago
Updated 1 August 2024, 5 months ago

Problem/Motivation

The content_moderation_control extra field created in \Drupal\content_moderation\EntityTypeInfo::entityExtraFieldInfo() is currently set as visible by default:

  public function entityExtraFieldInfo() {
    $return = [];
    foreach ($this->getModeratedBundles() as $bundle) {
      $return[$bundle['entity']][$bundle['bundle']]['display']['content_moderation_control'] = [
        'label' => $this->t('Moderation control'),
        'description' => $this->t("Status listing and form for the entity's moderation state."),
        'weight' => -20,
        'visible' => TRUE,
      ];
    }

    return $return;
  }

This means that all non-default displays of moderated entities also get this, and in some cases this may be an issue, for example, if we render a teaser of a node in a view, or a summary of a referenced entity inside an entity browser widget, etc.

Proposed resolution

Discuss the best alternative to prevent the extra field from showing up in unwanted scenarios.

One approach suggested by @Berdir is to make the extra field hidden by default, and every time an entity is made "moderatable" in a workflow, enable the extra field in the default display of that entity.

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Content moderation 

Last updated 24 days ago

Created by

🇪🇸Spain marcoscano Barcelona, Spain

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.

Production build 0.71.5 2024