original_string: 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());
      }
code: 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());
      }
code_tokens: 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 ( ) ) ; }
docstring: Deletes the given link.
  
  @param int $id Link's ID
  @return void
docstring_tokens: Deletes the given link .