SettingsMetadata
in package
Class SettingsMetadata
Table of Contents
Properties
- $bootCache : array<string|int, mixed>
Methods
- getMetadata() : array<string|int, mixed>
- WARNING: This interface may change.
- _filterSettingsSpecification() : mixed
- Filter the settings metadata according to filters passed in. This is a convenience filter and allows selective reverting / filling of settings
- fillOptions() : mixed
- Retrieve options from settings metadata
- getBootMetadata() : array<string|int, mixed>
- Get the starting metadata for boot settings from core. No hooks are called.
- getFullMetadata() : array<string|int, mixed>
- Get the final metadata for all settings - sources from extensions etc using alterSettingsFolders / alterSettingsMetadata hooks
- loadSettingsMetadata() : array<string|int, mixed>
- Load up settings metadata from files.
- loadSettingsMetaDataFolders() : array<string|int, mixed>
- Load the settings files defined in a series of folders.
Properties
$bootCache
protected
static array<string|int, mixed>
$bootCache
= NULL
Cache for boot settings metadata (which is used before Civi::cache is available)
Methods
getMetadata()
WARNING: This interface may change.
public
static getMetadata([array<string|int, mixed> $filters = [] ][, int $domainID = NULL ][, bool|array<string|int, mixed> $loadOptions = FALSE ][, bool $bootOnly = FALSE ]) : array<string|int, mixed>
This provides information about the setting - similar to the fields concept for DAO information. As the setting is serialized code creating validation setting input needs to know the data type This also helps move information out of the form layer into the data layer where people can interact with it via the API or other mechanisms. In order to keep this consistent it is important the form layer also leverages it.
Note that this function should never be called when using the runtime getvalue function. Caching works around the expectation it will be called during setting administration
Function is intended for configuration rather than runtime access to settings
The following params will filter the result. If none are passed all settings will be returns
Parameters
- $filters : array<string|int, mixed> = []
- $domainID : int = NULL
- $loadOptions : bool|array<string|int, mixed> = FALSE
-
The final param optionally restricts to only boot-time settings
- $bootOnly : bool = FALSE
-
- only
Return values
array<string|int, mixed> —the following information as appropriate for each setting
- name
- type
- default
- add (CiviCRM version added)
- is_domain
- is_contact
- description
- help_text
- options
- pseudoconstant
- global_name (name for php constant / environment variable corresponding to this setting)
- is_env_loadable (whether this setting should be read from corresponding environment variable)
- is_constant (whether a PHP constant should be defined for this setting)
_filterSettingsSpecification()
Filter the settings metadata according to filters passed in. This is a convenience filter and allows selective reverting / filling of settings
protected
static _filterSettingsSpecification(array<string|int, mixed> $filters, array<string|int, mixed> &$settingSpec) : mixed
Parameters
- $filters : array<string|int, mixed>
-
Filters to match against data.
- $settingSpec : array<string|int, mixed>
-
Metadata to filter.
fillOptions()
Retrieve options from settings metadata
protected
static fillOptions(array<string|int, mixed> &$settingSpec, bool|array<string|int, mixed> $optionsFormat) : mixed
Parameters
- $settingSpec : array<string|int, mixed>
- $optionsFormat : bool|array<string|int, mixed>
-
TRUE for a flat array; otherwise an array of keys to return
getBootMetadata()
Get the starting metadata for boot settings from core. No hooks are called.
protected
static getBootMetadata() : array<string|int, mixed>
Return values
array<string|int, mixed> —boot settings metadata
getFullMetadata()
Get the final metadata for all settings - sources from extensions etc using alterSettingsFolders / alterSettingsMetadata hooks
protected
static getFullMetadata([int|null $domainID = NULL ]) : array<string|int, mixed>
Parameters
- $domainID : int|null = NULL
Return values
array<string|int, mixed> —all settings metadata
loadSettingsMetadata()
Load up settings metadata from files.
protected
static loadSettingsMetadata(string $metaDataFolder[, string $filePattern = '*.setting.php' ]) : array<string|int, mixed>
Parameters
- $metaDataFolder : string
- $filePattern : string = '*.setting.php'
Return values
array<string|int, mixed>loadSettingsMetaDataFolders()
Load the settings files defined in a series of folders.
protected
static loadSettingsMetaDataFolders(array<string|int, mixed> $metaDataFolders) : array<string|int, mixed>
Parameters
- $metaDataFolders : array<string|int, mixed>
-
List of folder paths.