You are here

public function MicrositeMenuItem::deleteLink 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::deleteLink()

Deletes a menu link.

In general, this method should not be called directly, but will be called automatically from MenuLinkManagerInterface::removeDefinition().

This method will only delete the link from any additional storage, but not from the plugin.manager.menu.link service.

Throws

\Drupal\Component\Plugin\Exception\PluginException If the link is not deletable.

Overrides MenuLinkBase::deleteLink

File

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

Class

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

Namespace

Drupal\entity_hierarchy_microsite\Plugin\Menu

Code

public function deleteLink() {
  if (!$this
    ->getOverrideEntity()
    ->isNew()) {
    $this
      ->getOverrideEntity()
      ->delete();
  }
}