Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ContentModerationHooks.php

function ContentModerationHooks::entityBundleFieldInfo

Implements hook_entity_bundle_field_info().

File

core/modules/content_moderation/src/Hook/ContentModerationHooks.php, line 90

Class

ContentModerationHooks
Hook implementations for content_moderation.

Namespace

Drupal\content_moderation\Hook

Code

public function entityBundleFieldInfo(EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) {
    if (isset($base_field_definitions['moderation_state'])) {
        // Add the target bundle to the moderation state field. Since each bundle
        // can be attached to a different moderation workflow, adding this
        // information to the field definition allows the associated workflow to be
        // derived where a field definition is present.
        $base_field_definitions['moderation_state']->setTargetBundle($bundle);
        return [
            'moderation_state' => $base_field_definitions['moderation_state'],
        ];
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal