Issue #2843678 by Sam152: Remove dead code in hook_entity_bundle_field_info_alter
parent
38092ac0a0
commit
8af814f70d
|
@ -72,15 +72,6 @@ function content_moderation_entity_operation(EntityInterface $entity) {
|
||||||
->entityOperation($entity);
|
->entityOperation($entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets required flag based on enabled state.
|
|
||||||
*/
|
|
||||||
function content_moderation_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle) {
|
|
||||||
\Drupal::service('class_resolver')
|
|
||||||
->getInstanceFromDefinition(EntityTypeInfo::class)
|
|
||||||
->entityBundleFieldInfoAlter($fields, $entity_type, $bundle);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_entity_presave().
|
* Implements hook_entity_presave().
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -333,24 +333,6 @@ class EntityTypeInfo implements ContainerInjectionInterface {
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds ModerationState constraint to bundles whose entities are moderated.
|
|
||||||
*
|
|
||||||
* @param \Drupal\Core\Field\FieldDefinitionInterface[] $fields
|
|
||||||
* The array of bundle field definitions.
|
|
||||||
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
|
||||||
* The entity type definition.
|
|
||||||
* @param string $bundle
|
|
||||||
* The bundle.
|
|
||||||
*
|
|
||||||
* @see hook_entity_bundle_field_info_alter();
|
|
||||||
*/
|
|
||||||
public function entityBundleFieldInfoAlter(&$fields, EntityTypeInterface $entity_type, $bundle) {
|
|
||||||
if (!empty($fields['moderation_state']) && $this->moderationInfo->shouldModerateEntitiesOfBundle($entity_type, $bundle)) {
|
|
||||||
$fields['moderation_state']->addConstraint('ModerationState', []);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alters bundle forms to enforce revision handling.
|
* Alters bundle forms to enforce revision handling.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue