MenuLinkContentDeleteForm.php

Same filename and directory in other branches
  1. 9 core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php
  2. 8.9.x core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php
  3. 11.x core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php

Namespace

Drupal\menu_link_content\Form

File

core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php

View source
<?php

namespace Drupal\menu_link_content\Form;

use Drupal\Core\Entity\ContentEntityDeleteForm;
use Drupal\Core\Url;

/**
 * Provides a delete form for content menu links.
 *
 * @internal
 */
class MenuLinkContentDeleteForm extends ContentEntityDeleteForm {
  
  /**
   * {@inheritdoc}
   */
  public function getCancelUrl() {
    if ($this->moduleHandler
      ->moduleExists('menu_ui')) {
      return new Url('entity.menu.edit_form', [
        'menu' => $this->entity
          ->getMenuName(),
      ]);
    }
    return $this->entity
      ->toUrl();
  }
  
  /**
   * {@inheritdoc}
   */
  protected function getRedirectUrl() {
    return $this->getCancelUrl();
  }
  
  /**
   * {@inheritdoc}
   */
  protected function getDeletionMessage() {
    return $this->t('The menu link %title has been deleted.', [
      '%title' => $this->entity
        ->label(),
    ]);
  }

}

Classes

Title Deprecated Summary
MenuLinkContentDeleteForm Provides a delete form for content menu links.

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