public function disable($id)
    {
        $this->loadModel('Locale.Languages');
        $language = $this->Languages->get($id);

        if (!in_array($language->code, [CORE_LOCALE, option('default_language')])) {
            $language->set('status', false);
            if ($this->Languages->save($language)) {
                $this->Flash->success(__d('locale', 'Language successfully disabled!'));
            } else {
                $this->Flash->danger(__d('locale', 'Language could not be disabled, please try again.'));
            }
        } else {
            $this->Flash->danger(__d('locale', 'You cannot disable this language as it still in use.'));
        }

        $this->title(__d('locale', 'Disable Language'));
        $this->redirect($this->referer());
    }
public function disable($id)
    {
        $this->loadModel('Locale.Languages');
        $language = $this->Languages->get($id);

        if (!in_array($language->code, [CORE_LOCALE, option('default_language')])) {
            $language->set('status', false);
            if ($this->Languages->save($language)) {
                $this->Flash->success(__d('locale', 'Language successfully disabled!'));
            } else {
                $this->Flash->danger(__d('locale', 'Language could not be disabled, please try again.'));
            }
        } else {
            $this->Flash->danger(__d('locale', 'You cannot disable this language as it still in use.'));
        }

        $this->title(__d('locale', 'Disable Language'));
        $this->redirect($this->referer());
    }
public function disable ( $ id ) { $ this -> loadModel ( 'Locale.Languages' ) ; $ language = $ this -> Languages -> get ( $ id ) ; if ( ! in_array ( $ language -> code , [ CORE_LOCALE , option ( 'default_language' ) ] ) ) { $ language -> set ( 'status' , false ) ; if ( $ this -> Languages -> save ( $ language ) ) { $ this -> Flash -> success ( __d ( 'locale' , 'Language successfully disabled!' ) ) ; } else { $ this -> Flash -> danger ( __d ( 'locale' , 'Language could not be disabled, please try again.' ) ) ; } } else { $ this -> Flash -> danger ( __d ( 'locale' , 'You cannot disable this language as it still in use.' ) ) ; } $ this -> title ( __d ( 'locale' , 'Disable Language' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; }
Disables the given language.

@param int $id Language's ID
@return void Redirects to previous page
Disables the given language .