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 * Set the value of one or more CiviCRM settings.
28 * @method array getValues
29 * @method $this setValues(array $value)
30 * @method $this addValue(string $name, mixed $value)
32 class Set
extends AbstractSettingAction
{
35 * Setting names/values to set.
40 protected $values = [];
43 * @param \Civi\Api4\Generic\Result $result
44 * @param \Civi\Core\SettingsBag $settingsBag
49 protected function processSettings(Result
$result, $settingsBag, $meta, $domain) {
50 foreach ($this->values
as $name => $value) {
51 if (isset($value) && !empty($meta[$name]['serialize'])) {
52 $value = \CRM_Core_DAO
::serializeField($value, $meta[$name]['serialize']);
54 $settingsBag->set($name, $value);
57 'value' => $this->values
[$name],
58 'domain_id' => $domain,