original_string: public function edit($id)
      {
          $this->loadModel('User.Roles');
          $role = $this->Roles->get($id);
  
          if ($this->request->data()) {
              if (empty($this->request->data['regenerate_slug'])) {
                  $this->Roles->behaviors()->Sluggable->config(['on' => 'create']);
              }
  
              $role = $this->Roles->patchEntity($role, $this->request->data(), ['fieldList' => 'name']);
              if ($this->Roles->save($role)) {
                  $this->Flash->success(__d('user', 'Role successfully updated.'));
              } else {
                  $this->Flash->danger(__d('user', 'Role could not be updated.'));
              }
          }
  
          $this->title(__d('user', 'Editing User Role'));
          $this->set(compact('role'));
          $this->Breadcrumb
              ->push('/admin/user/manage')
              ->push(__d('user', 'Roles'), ['plugin' => 'User', 'controller' => 'roles', 'action' => 'index'])
              ->push(__d('user', 'Edit role'), '');
      }
code: public function edit($id)
      {
          $this->loadModel('User.Roles');
          $role = $this->Roles->get($id);
  
          if ($this->request->data()) {
              if (empty($this->request->data['regenerate_slug'])) {
                  $this->Roles->behaviors()->Sluggable->config(['on' => 'create']);
              }
  
              $role = $this->Roles->patchEntity($role, $this->request->data(), ['fieldList' => 'name']);
              if ($this->Roles->save($role)) {
                  $this->Flash->success(__d('user', 'Role successfully updated.'));
              } else {
                  $this->Flash->danger(__d('user', 'Role could not be updated.'));
              }
          }
  
          $this->title(__d('user', 'Editing User Role'));
          $this->set(compact('role'));
          $this->Breadcrumb
              ->push('/admin/user/manage')
              ->push(__d('user', 'Roles'), ['plugin' => 'User', 'controller' => 'roles', 'action' => 'index'])
              ->push(__d('user', 'Edit role'), '');
      }
code_tokens: public function edit ( $ id ) { $ this -> loadModel ( 'User.Roles' ) ; $ role = $ this -> Roles -> get ( $ id ) ; if ( $ this -> request -> data ( ) ) { if ( empty ( $ this -> request -> data [ 'regenerate_slug' ] ) ) { $ this -> Roles -> behaviors ( ) -> Sluggable -> config ( [ 'on' => 'create' ] ) ; } $ role = $ this -> Roles -> patchEntity ( $ role , $ this -> request -> data ( ) , [ 'fieldList' => 'name' ] ) ; if ( $ this -> Roles -> save ( $ role ) ) { $ this -> Flash -> success ( __d ( 'user' , 'Role successfully updated.' ) ) ; } else { $ this -> Flash -> danger ( __d ( 'user' , 'Role could not be updated.' ) ) ; } } $ this -> title ( __d ( 'user' , 'Editing User Role' ) ) ; $ this -> set ( compact ( 'role' ) ) ; $ this -> Breadcrumb -> push ( '/admin/user/manage' ) -> push ( __d ( 'user' , 'Roles' ) , [ 'plugin' => 'User' , 'controller' => 'roles' , 'action' => 'index' ] ) -> push ( __d ( 'user' , 'Edit role' ) , '' ) ; }
docstring: Edits the given role.
  
  @param int $id Role ID
  @return void
docstring_tokens: Edits the given role .