/** * Set all settings from plugin core class * * @param Market_SettingsModel $settings * * @return bool */ public function save(Market_SettingsModel $settings) { if (!$settings->validate()) { $errors = $settings->getAllErrors(); return false; } craft()->plugins->savePluginSettings($this->_plugin, $settings); return true; }
/** * @throws HttpException */ public function actionSaveSettings() { $this->requireAdmin(); $this->requirePostRequest(); $postData = craft()->request->getPost('settings'); $settings = Market_SettingsModel::populateModel($postData); if (!craft()->market_settings->save($settings)) { craft()->userSession->setError(Craft::t('Error, Market settings not saved.')); $this->renderTemplate('market/settings', ['settings' => $settings]); } else { craft()->userSession->setNotice(Craft::t('Success, Market settings saved.')); $this->redirectToPostedUrl(); } }