class SettingsManager

Class SettingsManager

Properties

protected CRM_Utils_Cache_Interface $cache
protected Array $bagsByDomain
protected Array $bagsByContact
protected array|NULL $mandatory
protected bool $useDefaults Whether to use defaults.

Methods

__construct(CRM_Utils_Cache_Interface $cache)

No description

useDefaults()

Ensure that all defaults values are included with all current and future bags.

useMandatory()

Ensure that mandatory values are included with all current and future bags.

getBagByDomain(int|NULL $domainId)

No description

getBagByContact(int|NULL $domainId, int|NULL $contactId)

No description

array
getDefaults(string $entity)

Determine the default settings.

array
getMandatory(string $entity)

Get a list of mandatory/overriden settings.

static array
parseMandatorySettings(array $civicrm_setting)

Parse mandatory settings.

flush()

Flush all in-memory and persistent caches related to settings.

Details

at line 94
__construct(CRM_Utils_Cache_Interface $cache)

Parameters

CRM_Utils_Cache_Interface $cache A semi-durable location to store metadata.

at line 104
SettingsManager useDefaults()

Ensure that all defaults values are included with all current and future bags.

Return Value

SettingsManager

at line 135
SettingsManager useMandatory()

Ensure that mandatory values are included with all current and future bags.

If you call useMandatory multiple times, it will re-scan the global $civicrm_setting.

Return Value

SettingsManager

at line 155
SettingsBag getBagByDomain(int|NULL $domainId)

Parameters

int|NULL $domainId

Return Value

SettingsBag

at line 177
SettingsBag getBagByContact(int|NULL $domainId, int|NULL $contactId)

Parameters

int|NULL $domainId
int|NULL $contactId

Return Value

SettingsBag

at line 203
protected array getDefaults(string $entity)

Determine the default settings.

Parameters

string $entity Ex: 'domain' or 'contact'.

Return Value

array Array(string $settingName => mixed $value).

at line 232
protected array getMandatory(string $entity)

Get a list of mandatory/overriden settings.

Parameters

string $entity Ex: 'domain' or 'contact'.

Return Value

array Array(string $settingName => mixed $value).

at line 257
static array parseMandatorySettings(array $civicrm_setting)

Parse mandatory settings.

In previous versions, settings were broken down into verbose+dynamic group names, e.g.

$civicrm_settings['Foo Bar Preferences']['foo'] = 'bar';

We now simplify to two simple groups, 'domain' and 'contact'.

$civicrm_settings['domain']['foo'] = 'bar';

However, the old groups are grand-fathered in as aliases.

Parameters

array $civicrm_setting Ex: $civicrm_setting['Group Name']['field'] = 'value'. Group names are an historical quirk; ignore them.

Return Value

array

at line 298
SettingsManager flush()

Flush all in-memory and persistent caches related to settings.

Return Value

SettingsManager