/**
  * Modifies an entity type definition to include moderation configuration support.
  *
  * 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.
  *
  * @param \Drupal\Core\Config\Entity\ConfigEntityTypeInterface $type
  *   The config entity definition to modify.
  *
  * @return \Drupal\Core\Config\Entity\ConfigEntityTypeInterface
  *   The modified config entity definition.
  */
 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;
 }