You are here

public function PathPluginBase::remove in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/display/PathPluginBase.php \Drupal\views\Plugin\views\display\PathPluginBase::remove()
  2. 9 core/modules/views/src/Plugin/views/display/PathPluginBase.php \Drupal\views\Plugin\views\display\PathPluginBase::remove()

Reacts on deleting a display.

Overrides DisplayPluginInterface::remove

File

core/modules/views/src/Plugin/views/display/PathPluginBase.php, line 567

Class

PathPluginBase
The base display plugin for path/callbacks. This is used for pages and feeds.

Namespace

Drupal\views\Plugin\views\display

Code

public function remove() {
  $menu_links = $this
    ->getMenuLinks();

  /** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
  $menu_link_manager = \Drupal::service('plugin.manager.menu.link');
  foreach ($menu_links as $menu_link_id => $menu_link) {
    $menu_link_manager
      ->removeDefinition("views_view:{$menu_link_id}");
  }
}