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 * Revert one or more CiviCRM settings to their default value.
28 * @method array getSelect
29 * @method $this addSelect(string $name)
30 * @method $this setSelect(array $select)
32 class Revert
extends AbstractSettingAction
{
35 * Names of settings to revert
40 protected $select = [];
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->select
as $name) {
51 $settingsBag->revert($name);
54 'value' => $settingsBag->get($name),
55 'domain_id' => $domain,
58 foreach ($result as $name => &$setting) {
59 if (isset($setting['value']) && !empty($meta[$name]['serialize'])) {
60 $setting['value'] = \CRM_Core_DAO
::unSerializeField($setting['value'], $meta[$name]['serialize']);