trait CRM_Admin_Form_SettingTrait

This trait allows us to consolidate Preferences & Settings forms.

It is intended mostly as part of a refactoring process to get rid of having 2.

Properties

protected array $settingsMetadata

Methods

string
getDefaultEntity()

Get default entity.

array
getSettingsMetaData()

Get the metadata relating to the settings on the form, ordered by the keys in $this->_settings.

array
getSettingsToSetByMetadata(array $params)

Get the settings which can be stored based on metadata.

filterParamsSetByMetadata($params)

No description

mixed
getSettingMetadata($setting)

Get the metadata for a particular field.

mixed
getSettingMetadataItem($setting, $item)

Get the metadata for a particular field for a particular item.

string
getSettingPageFilter()

This is public so we can retrieve the filter name via hooks etc. and apply conditional logic (eg. loading javascript conditionals).

array
getSettingsOrderedByWeight()

Returns a re-keyed copy of the settings, ordered by weight.

addFieldsDefinedInSettingsMetadata()

Add fields in the metadata to the template.

string
getQuickFormType(array $spec)

Get the quickform type for the given html type.

setDefaultsForMetadataDefinedFields()

Get the defaults for all fields defined in the metadata.

saveMetadataDefinedSettings(array $params)

Save any fields which have been defined via metadata.

static array
reorderSortableOptions($setting, $options)

Display options in correct order on the form

Details

at line 58
string getDefaultEntity()

Get default entity.

Return Value

string

at line 67
protected array getSettingsMetaData()

Get the metadata relating to the settings on the form, ordered by the keys in $this->_settings.

Return Value

array

at line 82
protected array getSettingsToSetByMetadata(array $params)

Get the settings which can be stored based on metadata.

Parameters

array $params

Return Value

array

at line 98
protected filterParamsSetByMetadata($params)

Parameters

$params

at line 111
protected mixed getSettingMetadata($setting)

Get the metadata for a particular field.

Parameters

$setting

Return Value

mixed

at line 124
protected mixed getSettingMetadataItem($setting, $item)

Get the metadata for a particular field for a particular item.

e.g get 'serialize' key, if exists, for a field.

Parameters

$setting
$item

Return Value

mixed

at line 133
string getSettingPageFilter()

This is public so we can retrieve the filter name via hooks etc. and apply conditional logic (eg. loading javascript conditionals).

Return Value

string

at line 147
protected array getSettingsOrderedByWeight()

Returns a re-keyed copy of the settings, ordered by weight.

Return Value

array

at line 171
protected addFieldsDefinedInSettingsMetadata()

Add fields in the metadata to the template.

at line 279
protected string getQuickFormType(array $spec)

Get the quickform type for the given html type.

Parameters

array $spec

Return Value

string

at line 313
protected setDefaultsForMetadataDefinedFields()

Get the defaults for all fields defined in the metadata.

All others are pending conversion.

at line 340
protected saveMetadataDefinedSettings(array $params)

Save any fields which have been defined via metadata.

(Other fields are hack-handled... sadly.

Parameters

array $params Form input.

Exceptions

CiviCRM_API3_Exception

at line 365
static array reorderSortableOptions($setting, $options)

Display options in correct order on the form

Parameters

$setting
$options

Return Value

array