Same name and namespace in other branches
  1. 8.9.x core/modules/content_moderation/content_moderation.module \content_moderation_entity_bundle_field_info()
  2. 9 core/modules/content_moderation/content_moderation.module \content_moderation_entity_bundle_field_info()

Implements hook_entity_bundle_field_info().

File

core/modules/content_moderation/content_moderation.module, line 74
Contains content_moderation.module.

Code

function content_moderation_entity_bundle_field_info(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'],
    ];
  }
}