public function delete($id)
    {
        $this->loadModel('Menu.MenuLinks');
        $link = $this->MenuLinks->get($id);
        $this->MenuLinks->addBehavior('Tree', ['scope' => ['menu_id' => $link->menu_id]]);
        $this->MenuLinks->removeFromTree($link);

        if ($this->MenuLinks->delete($link)) {
            $this->Flash->success(__d('menu', 'Link successfully removed!'));
        } else {
            $this->Flash->danger(__d('menu', 'Link could not be removed, please try again'));
        }

        $this->title(__d('menu', 'Delete Link'));
        $this->redirect($this->referer());
    }
public function delete($id)
    {
        $this->loadModel('Menu.MenuLinks');
        $link = $this->MenuLinks->get($id);
        $this->MenuLinks->addBehavior('Tree', ['scope' => ['menu_id' => $link->menu_id]]);
        $this->MenuLinks->removeFromTree($link);

        if ($this->MenuLinks->delete($link)) {
            $this->Flash->success(__d('menu', 'Link successfully removed!'));
        } else {
            $this->Flash->danger(__d('menu', 'Link could not be removed, please try again'));
        }

        $this->title(__d('menu', 'Delete Link'));
        $this->redirect($this->referer());
    }
public function delete ( $ id ) { $ this -> loadModel ( 'Menu.MenuLinks' ) ; $ link = $ this -> MenuLinks -> get ( $ id ) ; $ this -> MenuLinks -> addBehavior ( 'Tree' , [ 'scope' => [ 'menu_id' => $ link -> menu_id ] ] ) ; $ this -> MenuLinks -> removeFromTree ( $ link ) ; if ( $ this -> MenuLinks -> delete ( $ link ) ) { $ this -> Flash -> success ( __d ( 'menu' , 'Link successfully removed!' ) ) ; } else { $ this -> Flash -> danger ( __d ( 'menu' , 'Link could not be removed, please try again' ) ) ; } $ this -> title ( __d ( 'menu' , 'Delete Link' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; }
Deletes the given link.

@param int $id Link's ID
@return void
Deletes the given link .