setDefaultsForMetadataDefinedFields(); return $this->_defaults; } /** * Build the form object. */ public function buildQuickForm() { $filter = array_pop($this->urlPath); $settings = civicrm_api3('Setting', 'getfields', [])['values']; foreach ($settings as $key => $setting) { if (isset($setting['settings_pages'][$filter])) { $this->_settings[$key] = $setting; } } // @todo sort settings by weight. $this->addFieldsDefinedInSettingsMetadata(); // @todo look at sharing the code below in the settings trait. if ($this->includesReadOnlyFields) { CRM_Core_Session::setStatus(ts("Some fields are loaded as 'readonly' as they have been set (overridden) in civicrm.settings.php."), '', 'info', array('expires' => 0)); } // @todo - do we still like this redirect? CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1')); $this->addButtons(array( array( 'type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE, ), array( 'type' => 'cancel', 'name' => ts('Cancel'), ), ) ); } /** * Process the form submission. */ public function postProcess() { $params = $this->controller->exportValues($this->_name); try { $this->saveMetadataDefinedSettings($params); } catch (CiviCRM_API3_Exception $e) { CRM_Core_Session::setStatus($e->getMessage(), ts('Save Failed'), 'error'); } } }