function content_moderation_entity_bundle_field_info

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/content_moderation.module \content_moderation_entity_bundle_field_info()
  2. 8.9.x core/modules/content_moderation/content_moderation.module \content_moderation_entity_bundle_field_info()
  3. 10 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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.