![]() |
CMS
Version 3.9
|
The Settings class provides components with a common API for specifying application settings and configuration values. More...
Inherits DataItem.
Public Member Functions | |
save () | |
permitsRole ($role) | |
formatOptionList () | |
Static Public Member Functions | |
static | getSetting ($component, $name) |
static | getValue ($component, $name) |
Retrieve the value of the specified Setting. More... | |
static | setValue ($component, $name, $value, $field_type, $annotation="", $category="", $options="", $weight=0) |
Sets the value of the given component setting. More... | |
static | setDefaultValue ($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0) |
Sets the default value of the given component setting. More... | |
static | deleteValue ($component, $name) |
Delete the specified value from the settings table. More... | |
static | setPermission ($component, $name, $annotation, $value, $weight) |
Set a Permission value indicating which SiteRoles have the given permission. More... | |
static | setDefaultPermission ($component, $name, $annotation, $value, $weight=0) |
Set a default Permission value indicating which SiteRoles have the given permission. More... | |
static | checkPermission ($component, $name, $account=null) |
Check whether a user has a specific permission. More... | |
static | assertPermission ($component, $name, $redirect="", $message="") |
Asserts whether the current user has a specific permission, optionally redirecting to a specified location if they do not. More... | |
static | checkPermissions ($permissions, $account=null) |
Check all the permissions specified in the given string. More... | |
static | deletePermission ($component, $name) |
Deletes the specified permissions. More... | |
static | getComponents () |
static | createPermissionsFieldRenderer ($form, $field, $label="") |
Public Attributes | |
$primary_key = "settings_id" | |
$table = "settings" | |
$fields | |
$relations = array() | |
Static Public Attributes | |
static | $fieldTypes |
The Settings class provides components with a common API for specifying application settings and configuration values.
These settings are stored in the application database and can be modified through the site administration screens.
Definition at line 48 of file settings.inc.
|
static |
Asserts whether the current user has a specific permission, optionally redirecting to a specified location if they do not.
string | $component | the component that owns the permission |
string | $name | the unique name of the permission |
string | $redirect | URL to redirect to on failure |
Definition at line 255 of file settings.inc.
|
static |
Check whether a user has a specific permission.
string | $component | the component that owns the permission |
string | $name | the unique name of the permission |
object | $account | (optional) user account to test. If not specified the currently logged in user is tested. |
Definition at line 241 of file settings.inc.
|
static |
Check all the permissions specified in the given string.
If the user belongs to a role with ONE of the specified permissions, return true. If the user does not, return false.
string | $permissions | permission list in the form "[component]:[permission],[component]:[permission]..." |
object | $account | (optional) user account to test. If not specified the currently logged in user is tested. |
Definition at line 270 of file settings.inc.
|
static |
Definition at line 343 of file settings.inc.
|
static |
Deletes the specified permissions.
string | $component | the name of the component to which the permission belongs |
string | $name | the name of the permission to be deleted |
Definition at line 290 of file settings.inc.
|
static |
Delete the specified value from the settings table.
string | $component | the name of the component that owns the setting |
string | $name | the name of the setting to be deleted |
Definition at line 195 of file settings.inc.
Settings::formatOptionList | ( | ) |
Definition at line 312 of file settings.inc.
|
static |
Definition at line 338 of file settings.inc.
|
static |
Definition at line 83 of file settings.inc.
|
static |
Retrieve the value of the specified Setting.
string | $component | the name of the component that owns the setting |
string | $name | the name of the setting |
Definition at line 104 of file settings.inc.
Settings::permitsRole | ( | $role | ) |
Definition at line 296 of file settings.inc.
Settings::save | ( | ) |
Definition at line 77 of file settings.inc.
|
static |
Set a default Permission value indicating which SiteRoles have the given permission.
string | $component | the name of the component that owns the permission |
string | $name | the unique name of the permission |
string | $annotation | short description of the permission |
string | $value | comma-separated list of roles that have the permission |
int | $weight | optional weight parameter to control display order |
Definition at line 230 of file settings.inc.
|
static |
Sets the default value of the given component setting.
Creating settings for a component using this method will generate a tab under the Application Settings area of the site administration interface, allowing your users to control your component's behavior.
string | component the name of the component that owns the setting | |
string | $name | the name of the setting (this will be automatically prettified when presented to the user) |
mixed | $value | the default value for the setting. If the setting has already been defined, the value will not be overwritten |
string | $field_type | the type of field renderer to use to display the setting in the admin interface |
string | $annotation | any help annotation to display on the form (optional) |
string | $category | the sub-category within the form to which the setting belongs. Settings with the same category name are grouped together into fieldsets. |
number | $weight | a weighting factor to control display order on the Application Settings form. Controls are sorted (within categories) first by weight, then alphabetically (optional). |
Definition at line 174 of file settings.inc.
|
static |
Set a Permission value indicating which SiteRoles have the given permission.
string | $component | the name of the component that owns the permission |
string | $name | the unique name of the permission |
string | $annotation | short description of the permission |
string | $value | comma-separated list of roles that have the permission |
int | $weight | optional weight parameter to control display order |
Definition at line 217 of file settings.inc.
|
static |
Sets the value of the given component setting.
string | component the name of the component that owns the setting | |
string | $name | the name of the setting (this will be automatically prettified when presented to the user) |
mixed | $value | the default value for the setting. The value will be overwritten, even if previously set |
string | $field_type | the type of field renderer to use to display the setting in the admin interface |
string | $annotation | any help annotation to display on the form (optional) |
string | $category | the sub-category within the form to which the setting belongs. Settings with the same category name are grouped together into fieldsets. |
number | $weight | a weighting factor to control display order on the Application Settings form. Controls are sorted (within categories) first by weight, then alphabetically (optional). |
Definition at line 138 of file settings.inc.
Settings::$fields |
Definition at line 54 of file settings.inc.
|
static |
Definition at line 68 of file settings.inc.
Settings::$primary_key = "settings_id" |
Definition at line 50 of file settings.inc.
Settings::$relations = array() |
Definition at line 66 of file settings.inc.
Settings::$table = "settings" |
Definition at line 51 of file settings.inc.