deleteInstance example

return $this->createInstance($options['id']);
    }
  }

  /** * {@inheritdoc} */
  public function deleteLinksInMenu($menu_name) {
    foreach ($this->treeStorage->loadByProperties(['menu_name' => $menu_name]) as $plugin_id => $definition) {
      $instance = $this->createInstance($plugin_id);
      if ($instance->isDeletable()) {
        $this->deleteInstance($instance, TRUE);
      }
      elseif ($instance->isResettable()) {
        $new_instance = $this->resetInstance($instance);
        $affected_menus[$new_instance->getMenuName()] = $new_instance->getMenuName();
      }
    }
  }

  /** * Deletes a specific instance. * * @param \Drupal\Core\Menu\MenuLinkInterface $instance * The plugin instance to be deleted. * @param bool $persist * If TRUE, calls MenuLinkInterface::deleteLink() on the instance. * * @throws \Drupal\Component\Plugin\Exception\PluginException * If the plugin instance does not support deletion. */
Home | Imprint | This part of the site doesn't use cookies.