diff --git a/core/modules/book/lib/Drupal/book/Form/BookRemoveForm.php b/core/modules/book/lib/Drupal/book/Form/BookRemoveForm.php index 46b220d..ce84ea0 100644 --- a/core/modules/book/lib/Drupal/book/Form/BookRemoveForm.php +++ b/core/modules/book/lib/Drupal/book/Form/BookRemoveForm.php @@ -9,7 +9,6 @@ use Drupal\book\BookManager; use Drupal\Core\Form\ConfirmFormBase; -use Drupal\menu_link\MenuLinkStorageControllerInterface; use Drupal\node\NodeInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -19,20 +18,13 @@ class BookRemoveForm extends ConfirmFormBase { /** - * The book manager service. + * The book manager. * * @var \Drupal\book\BookManager */ protected $bookManager; /** - * The menu link storage controller. - * - * @var \Drupal\menu_link\MenuLinkStorageControllerInterface - */ - protected $menuLinkStorage; - - /** * The node representing the book. * * @var \Drupal\node\NodeInterface @@ -43,14 +35,10 @@ class BookRemoveForm extends ConfirmFormBase { * Constructs a BookRemoveForm object. * * @param \Drupal\book\BookManager $book_manager - * Book Manager Service. - * - * @param \Drupal\menu_link\MenuLinkStorageControllerInterface $menu_link_storage - * Menu Link Storage Controller. + * The book manager. */ - public function __construct(BookManager $book_manager, MenuLinkStorageControllerInterface $menu_link_storage) { + public function __construct(BookManager $book_manager) { $this->bookManager = $book_manager; - $this->menuLinkStorage = $menu_link_storage; } /** @@ -58,8 +46,7 @@ public function __construct(BookManager $book_manager, MenuLinkStorageController */ public static function create(ContainerInterface $container) { return new static( - $container->get('book.manager'), - $container->get('entity.manager')->getStorageController('menu_link') + $container->get('book.manager') ); } @@ -122,8 +109,7 @@ public function getCancelRoute() { */ public function submitForm(array &$form, array &$form_state) { if ($this->bookManager->checkNodeIsRemovable($this->node)) { - $menu_links = $this->menuLinkStorage->load(array($this->node->book['mlid'])); - $this->menuLinkStorage->delete($menu_links); + menu_link_delete($this->node->book['mlid']); $this->bookManager->deleteBook($this->node->id()); drupal_set_message($this->t('The post has been removed from the book.')); }