original_string: public function edit($id)
      {
          $this->loadModel('Locale.Languages');
          $language = $this->Languages->get($id);
          $languages = LocaleToolbox::languagesList(true);
          $icons = LocaleToolbox::flagsList();
  
          if ($this->request->data()) {
              $language = $this->Languages->patchEntity($language, $this->request->data, [
                  'fieldList' => [
                      'name',
                      'direction',
                      'icon',
                  ]
              ]);
  
              if ($this->Languages->save($language)) {
                  $this->Flash->success(__d('locale', 'Language was successfully saved!'));
                  $this->redirect($this->referer());
              } else {
                  $this->Flash->success(__d('locale', 'Language could not be saved, please check your information.'));
              }
          }
  
          $this->title(__d('locale', 'Editing Language'));
          $this->set(compact('language', 'languages', 'icons'));
          $this->Breadcrumb
              ->push('/admin/locale')
              ->push(__d('locale', 'Editing language'), '');
      }
code: public function edit($id)
      {
          $this->loadModel('Locale.Languages');
          $language = $this->Languages->get($id);
          $languages = LocaleToolbox::languagesList(true);
          $icons = LocaleToolbox::flagsList();
  
          if ($this->request->data()) {
              $language = $this->Languages->patchEntity($language, $this->request->data, [
                  'fieldList' => [
                      'name',
                      'direction',
                      'icon',
                  ]
              ]);
  
              if ($this->Languages->save($language)) {
                  $this->Flash->success(__d('locale', 'Language was successfully saved!'));
                  $this->redirect($this->referer());
              } else {
                  $this->Flash->success(__d('locale', 'Language could not be saved, please check your information.'));
              }
          }
  
          $this->title(__d('locale', 'Editing Language'));
          $this->set(compact('language', 'languages', 'icons'));
          $this->Breadcrumb
              ->push('/admin/locale')
              ->push(__d('locale', 'Editing language'), '');
      }
code_tokens: public function edit ( $ id ) { $ this -> loadModel ( 'Locale.Languages' ) ; $ language = $ this -> Languages -> get ( $ id ) ; $ languages = LocaleToolbox :: languagesList ( true ) ; $ icons = LocaleToolbox :: flagsList ( ) ; if ( $ this -> request -> data ( ) ) { $ language = $ this -> Languages -> patchEntity ( $ language , $ this -> request -> data , [ 'fieldList' => [ 'name' , 'direction' , 'icon' , ] ] ) ; if ( $ this -> Languages -> save ( $ language ) ) { $ this -> Flash -> success ( __d ( 'locale' , 'Language was successfully saved!' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; } else { $ this -> Flash -> success ( __d ( 'locale' , 'Language could not be saved, please check your information.' ) ) ; } } $ this -> title ( __d ( 'locale' , 'Editing Language' ) ) ; $ this -> set ( compact ( 'language' , 'languages' , 'icons' ) ) ; $ this -> Breadcrumb -> push ( '/admin/locale' ) -> push ( __d ( 'locale' , 'Editing language' ) , '' ) ; }
docstring: Edits language.
  
  @param int $id Language's ID
  @return void
docstring_tokens: Edits language .