protected EntityTypeInfo::addModerationToEntityType(ConfigEntityTypeInterface $type)
Configures moderation configuration support on a entity type definition.
That "configuration support" includes a configuration form, a hypermedia link, and a route provider to tie it all together. There's also a moderation handler for per-entity-type variation.
Parameters
\Drupal\Core\Config\Entity\ConfigEntityTypeInterface $type: The config entity definition to modify.
Return value
\Drupal\Core\Config\Entity\ConfigEntityTypeInterface The modified config entity definition.
File
- core/modules/content_moderation/src/EntityTypeInfo.php, line 164
Class
- EntityTypeInfo
- Manipulates entity type information.
Namespace
Drupal\content_moderation
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | protected function addModerationToEntityType(ConfigEntityTypeInterface $type ) { if ( $type ->hasLinkTemplate( 'edit-form' ) && ! $type ->hasLinkTemplate( 'moderation-form' )) { $type ->setLinkTemplate( 'moderation-form' , $type ->getLinkTemplate( 'edit-form' ) . '/moderation' ); } if (! $type ->getFormClass( 'moderation' )) { $type ->setFormClass( 'moderation' , BundleModerationConfigurationForm:: class ); } // @todo Core forgot to add a direct way to manipulate route_provider, so // we have to do it the sloppy way for now. $providers = $type ->getRouteProviderClasses() ? : []; if ( empty ( $providers [ 'moderation' ])) { $providers [ 'moderation' ] = EntityTypeModerationRouteProvider:: class ; $type ->setHandlerClass( 'route_provider' , $providers ); } return $type ; } |
Please login to continue.