function taxonomy_update_10100
Update entity definition to handle revision routes.
File
-
core/
modules/ taxonomy/ taxonomy.install, line 23
Code
function taxonomy_update_10100(&$sandbox = NULL) : TranslatableMarkup {
$entityDefinitionUpdateManager = \Drupal::entityDefinitionUpdateManager();
$definition = $entityDefinitionUpdateManager->getEntityType('taxonomy_term');
$routeProviders = $definition->get('route_provider');
$routeProviders['revision'] = RevisionHtmlRouteProvider::class;
$definition->setFormClass('revision-delete', RevisionDeleteForm::class)
->setFormClass('revision-revert', RevisionRevertForm::class)
->set('route_provider', $routeProviders)
->setLinkTemplate('revision-delete-form', '/taxonomy/term/{taxonomy_term}/revision/{taxonomy_term}/delete')
->setLinkTemplate('revision-revert-form', '/taxonomy/term/{taxonomy_term}/revision/{taxonomy_term}/revert')
->setLinkTemplate('version-history', '/taxonomy/term/{taxonomy_term}/revisions');
$entityDefinitionUpdateManager->updateEntityType($definition);
return \t('Added revision routes to Taxonomy Term entity type.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.