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
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.