function MenuDeleteForm::getDescription

Same name and namespace in other branches
  1. 9 core/modules/menu_ui/src/Form/MenuDeleteForm.php \Drupal\menu_ui\Form\MenuDeleteForm::getDescription()
  2. 8.9.x core/modules/menu_ui/src/Form/MenuDeleteForm.php \Drupal\menu_ui\Form\MenuDeleteForm::getDescription()
  3. 11.x core/modules/menu_ui/src/Form/MenuDeleteForm.php \Drupal\menu_ui\Form\MenuDeleteForm::getDescription()

Overrides EntityConfirmFormBase::getDescription

File

core/modules/menu_ui/src/Form/MenuDeleteForm.php, line 58

Class

MenuDeleteForm
Defines a confirmation form for deletion of a custom menu.

Namespace

Drupal\menu_ui\Form

Code

public function getDescription() {
  $caption = '';
  $num_links = $this->menuLinkManager
    ->countMenuLinks($this->entity
    ->id());
  if ($num_links) {
    $caption .= '<p>' . $this->formatPlural($num_links, '<strong>Warning:</strong> There is currently 1 menu link in %title. It will be deleted (system-defined links will be reset).', '<strong>Warning:</strong> There are currently @count menu links in %title. They will be deleted (system-defined links will be reset).', [
      '%title' => $this->entity
        ->label(),
    ]) . '</p>';
  }
  $caption .= '<p>' . $this->t('This action cannot be undone.') . '</p>';
  return $caption;
}

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