class MenuLinkContentDeleteForm

Same name and namespace in other branches
  1. 11.x core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php \Drupal\menu_link_content\Form\MenuLinkContentDeleteForm
  2. 10 core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php \Drupal\menu_link_content\Form\MenuLinkContentDeleteForm
  3. 9 core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php \Drupal\menu_link_content\Form\MenuLinkContentDeleteForm

Provides a delete form for content menu links.

@internal

Hierarchy

Expanded class hierarchy of MenuLinkContentDeleteForm

File

core/modules/menu_link_content/src/Form/MenuLinkContentDeleteForm.php, line 13

Namespace

Drupal\menu_link_content\Form
View source
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(),
    ]);
  }

}

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