Craft\AmForms_SettingsController::_saveSettings PHP Method

_saveSettings() private method

Save the settings for a specific type.
private _saveSettings ( string $type )
$type string
    private function _saveSettings($type)
    {
        $success = true;
        // Get all available settings for this type
        $availableSettings = craft()->amForms_settings->getAllSettingsByType($type);
        // Save each available setting
        foreach ($availableSettings as $setting) {
            // Find new settings
            $newSettings = craft()->request->getPost($setting->handle, false);
            if ($newSettings !== false) {
                $setting->value = $newSettings;
                if (!craft()->amForms_settings->saveSettings($setting)) {
                    $success = false;
                }
            }
        }
        // Save the settings in the plugins table
        $plugin = craft()->plugins->getPlugin('amForms');
        craft()->plugins->savePluginSettings($plugin, $plugin->getSettings());
        if ($success) {
            craft()->userSession->setNotice(Craft::t('Settings saved.'));
        } else {
            craft()->userSession->setError(Craft::t('Couldn’t save settings.'));
        }
    }