function ContentTranslationHandler::entityFormDeleteTranslationUrl

Same name and namespace in other branches
  1. 11.x core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::entityFormDeleteTranslationUrl()

Form submission handler for ContentTranslationHandler::entityFormAlter().

Get the entity delete form route url.

1 call to ContentTranslationHandler::entityFormDeleteTranslationUrl()
ContentTranslationHandler::entityFormAlter in core/modules/content_translation/src/ContentTranslationHandler.php
Performs the needed alterations to the entity form.

File

core/modules/content_translation/src/ContentTranslationHandler.php, line 817

Class

ContentTranslationHandler
Base class for content translation handlers.

Namespace

Drupal\content_translation

Code

protected function entityFormDeleteTranslationUrl(EntityInterface $entity, $form_langcode) {
  $entity_type_id = $entity->getEntityTypeId();
  $options = [];
  $options['query']['destination'] = $this->redirectDestination
    ->get();
  if ($entity->access('delete') && $this->entityType
    ->hasLinkTemplate('delete-form')) {
    return $entity->toUrl('delete-form', $options);
  }
  return Url::fromRoute("entity.{$entity_type_id}.content_translation_delete", [
    $entity_type_id => $entity->id(),
    'language' => $form_langcode,
  ], $options);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.