original_string: public function edit($id)
      {
          $this->loadModel('Menu.MenuLinks');
          $this->loadModel('Content.Contents');
          $link = $this->MenuLinks->get($id, ['contain' => ['Menus']]);
  
          if (!empty($this->request->data)) {
              $link = $this->MenuLinks->patchEntity($link, $this->request->data, [
                  'fieldList' => [
                      'title',
                      'url',
                      'description',
                      'target',
                      'expanded',
                      'active',
                      'activation',
                      'status'
                  ]
              ]);
  
              if ($this->MenuLinks->save($link, ['associated' => false])) {
                  $this->Flash->success(__d('menu', 'Link has been updated'));
                  $this->redirect($this->referer());
              } else {
                  $this->Flash->danger(__d('menu', 'Link could not be updated, please check your information'));
              }
          }
  
          $contentLinks = [];
          $contents = $this->Contents
              ->find()
              ->select(['id', 'slug', 'content_type_slug', 'title'])
              ->all();
          foreach ($contents as $content) {
              $contentLinks[$content->get('url')] = __d('menu', '{0} [{1}]', $content->title, $content->content_type_slug);
          }
  
          $this->title(__d('menu', 'Editing Link'));
          $this->set(compact('link', 'contentLinks'));
          $this->Breadcrumb
              ->push('/admin/menu/manage')
              ->push(__d('menu', 'Editing menu'), ['plugin' => 'Menu', 'controller' => 'manage', 'action' => 'edit', $link->menu_id])
              ->push(__d('menu', 'Links'), ['plugin' => 'Menu', 'controller' => 'links', 'action' => 'menu', $link->menu_id])
              ->push(__d('menu', 'Editing link'), '#');
      }
code: public function edit($id)
      {
          $this->loadModel('Menu.MenuLinks');
          $this->loadModel('Content.Contents');
          $link = $this->MenuLinks->get($id, ['contain' => ['Menus']]);
  
          if (!empty($this->request->data)) {
              $link = $this->MenuLinks->patchEntity($link, $this->request->data, [
                  'fieldList' => [
                      'title',
                      'url',
                      'description',
                      'target',
                      'expanded',
                      'active',
                      'activation',
                      'status'
                  ]
              ]);
  
              if ($this->MenuLinks->save($link, ['associated' => false])) {
                  $this->Flash->success(__d('menu', 'Link has been updated'));
                  $this->redirect($this->referer());
              } else {
                  $this->Flash->danger(__d('menu', 'Link could not be updated, please check your information'));
              }
          }
  
          $contentLinks = [];
          $contents = $this->Contents
              ->find()
              ->select(['id', 'slug', 'content_type_slug', 'title'])
              ->all();
          foreach ($contents as $content) {
              $contentLinks[$content->get('url')] = __d('menu', '{0} [{1}]', $content->title, $content->content_type_slug);
          }
  
          $this->title(__d('menu', 'Editing Link'));
          $this->set(compact('link', 'contentLinks'));
          $this->Breadcrumb
              ->push('/admin/menu/manage')
              ->push(__d('menu', 'Editing menu'), ['plugin' => 'Menu', 'controller' => 'manage', 'action' => 'edit', $link->menu_id])
              ->push(__d('menu', 'Links'), ['plugin' => 'Menu', 'controller' => 'links', 'action' => 'menu', $link->menu_id])
              ->push(__d('menu', 'Editing link'), '#');
      }
code_tokens: public function edit ( $ id ) { $ this -> loadModel ( 'Menu.MenuLinks' ) ; $ this -> loadModel ( 'Content.Contents' ) ; $ link = $ this -> MenuLinks -> get ( $ id , [ 'contain' => [ 'Menus' ] ] ) ; if ( ! empty ( $ this -> request -> data ) ) { $ link = $ this -> MenuLinks -> patchEntity ( $ link , $ this -> request -> data , [ 'fieldList' => [ 'title' , 'url' , 'description' , 'target' , 'expanded' , 'active' , 'activation' , 'status' ] ] ) ; if ( $ this -> MenuLinks -> save ( $ link , [ 'associated' => false ] ) ) { $ this -> Flash -> success ( __d ( 'menu' , 'Link has been updated' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; } else { $ this -> Flash -> danger ( __d ( 'menu' , 'Link could not be updated, please check your information' ) ) ; } } $ contentLinks = [ ] ; $ contents = $ this -> Contents -> find ( ) -> select ( [ 'id' , 'slug' , 'content_type_slug' , 'title' ] ) -> all ( ) ; foreach ( $ contents as $ content ) { $ contentLinks [ $ content -> get ( 'url' ) ] = __d ( 'menu' , '{0} [{1}]' , $ content -> title , $ content -> content_type_slug ) ; } $ this -> title ( __d ( 'menu' , 'Editing Link' ) ) ; $ this -> set ( compact ( 'link' , 'contentLinks' ) ) ; $ this -> Breadcrumb -> push ( '/admin/menu/manage' ) -> push ( __d ( 'menu' , 'Editing menu' ) , [ 'plugin' => 'Menu' , 'controller' => 'manage' , 'action' => 'edit' , $ link -> menu_id ] ) -> push ( __d ( 'menu' , 'Links' ) , [ 'plugin' => 'Menu' , 'controller' => 'links' , 'action' => 'menu' , $ link -> menu_id ] ) -> push ( __d ( 'menu' , 'Editing link' ) , '#' ) ; }
docstring: Edits the given menu link by ID.
  
  @param int $id Link's ID
  @return void
docstring_tokens: Edits the given menu link by ID .