/** * @service theme write * * @return Gpf_Rpc_Action */ public function toggleThemeEnabled(Gpf_Rpc_Params $params) { $action = new Gpf_Rpc_Action($params); try { $panel = $action->getParam('panelName'); $themeId = $action->getParam('themeId'); $theme = new Gpf_Desktop_Theme($themeId, $panel); if ($theme->isEnabled() && !$this->canDisableTheme($panel)) { $action->setInfoMessage($this->_('One theme should be enabled')); } else { $theme->setEnabled(!$theme->isEnabled()); } $action->addOk(); } catch (Exception $e) { $action->addError(); $action->setErrorMessage($e->getMessage()); } return $action; }