You are here

public function MicrositeMenuItem::getDeleteRoute in Entity Reference Hierarchy 8.2

Same name and namespace in other branches
  1. 3.x modules/entity_hierarchy_microsite/src/Plugin/Menu/MicrositeMenuItem.php \Drupal\entity_hierarchy_microsite\Plugin\Menu\MicrositeMenuItem::getDeleteRoute()

Returns route information for a route to delete the menu link.

Return value

\Drupal\Core\Url|null A Url object, or NULL if there is no route (e.g. when the link is not deletable).

Overrides MenuLinkBase::getDeleteRoute

File

modules/entity_hierarchy_microsite/src/Plugin/Menu/MicrositeMenuItem.php, line 101

Class

MicrositeMenuItem
Defines a class for a menu item based on hierarchy.

Namespace

Drupal\entity_hierarchy_microsite\Plugin\Menu

Code

public function getDeleteRoute() {
  if (!$this
    ->getOverrideEntity()
    ->isNew()) {
    return $this
      ->getOverrideEntity()
      ->toUrl('delete-form');
  }
}