4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
21 namespace Civi\Api4\Action\Setting
;
23 use Civi\Api4\Generic\Result
;
26 * Get the value of one or more CiviCRM settings.
28 * @method array getSelect
29 * @method $this setSelect(array $settingNames)
31 class Get
extends AbstractSettingAction
{
34 * Names of settings to retrieve
38 protected $select = [];
41 * @param \Civi\Api4\Generic\Result $result
42 * @param \Civi\Core\SettingsBag $settingsBag
47 protected function processSettings(Result
$result, $settingsBag, $meta, $domain) {
49 foreach ($this->select
as $name) {
52 'value' => $settingsBag->get($name),
53 'domain_id' => $domain,
58 foreach ($settingsBag->all() as $name => $value) {
62 'domain_id' => $domain,
66 foreach ($result as $name => &$setting) {
67 if (isset($setting['value']) && !empty($meta[$name]['serialize'])) {
68 $setting['value'] = \CRM_Core_DAO
::unSerializeField($setting['value'], $meta[$name]['serialize']);
74 * Add one or more settings to be selected
75 * @param string ...$settingNames
78 public function addSelect(string ...$settingNames) {
79 $this->select
= array_merge($this->select
, $settingNames);