Class pheme\settings\components\Settings
Inheritance | pheme\settings\components\Settings » yii\base\Component |
---|
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$cache | \yii\caching\Cache|string | The cache object or the application component ID of the cache object. | pheme\settings\components\Settings |
$cacheKey | string | Cache key | pheme\settings\components\Settings |
$frontCache | \yii\caching\Cache|string | The front cache object or the application component ID of the front cache object. | pheme\settings\components\Settings |
$modelClass | string | Settings model. | pheme\settings\components\Settings |
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$model | pheme\settings\models\SettingInterface | pheme\settings\components\Settings |
Public Methods
Method | Description | Defined By |
---|---|---|
activate() | Activates a setting | pheme\settings\components\Settings |
clearCache() | Clears the settings cache on demand. | pheme\settings\components\Settings |
deactivate() | Deactivates a setting | pheme\settings\components\Settings |
delete() | Deletes a setting | pheme\settings\components\Settings |
deleteAll() | Deletes all setting. Be careful! | pheme\settings\components\Settings |
get() | Get's the value for the given key and section. | pheme\settings\components\Settings |
getRawConfig() | Returns the raw configuration array | pheme\settings\components\Settings |
init() | Initialize the component | pheme\settings\components\Settings |
set() | pheme\settings\components\Settings |
Property Details
The cache object or the application component ID of the cache object. Settings will be cached through this cache object, if it is available.
After the Settings object is created, if you want to change this property, you should only assign it with a cache object. Set this property to null if you do not want to cache the settings.
Cache key
The front cache object or the application component ID of the front cache object. Front cache will be cleared through this cache object, if it is available.
After the Settings object is created, if you want to change this property, you should only assign it with a cache object. Set this property to null if you do not want to clear the front cache.
Settings model. Make sure your settings model calls clearCache in the afterSave callback
Method Details
Activates a setting
public bool activate ( $key, $section = null ) | ||
$key | ||
$section | null|string |
Clears the settings cache on demand.
If you haven't configured cache this does nothing.
public boolean clearCache ( ) | ||
return | boolean | True if the cache key was deleted and false otherwise |
---|
Deactivates a setting
public bool deactivate ( $key, $section = null ) | ||
$key | ||
$section | null|string |
Deletes a setting
public bool delete ( $key, $section = null ) | ||
$key | ||
$section | null|string |
Deletes all setting. Be careful!
public bool deleteAll ( ) |
Get's the value for the given key and section.
You can use dot notation to separate the section from the key: $value = $settings->get('section.key'); and $value = $settings->get('key', 'section'); are equivalent
public mixed get ( $key, $section = null, $default = null ) | ||
$key | ||
$section | null | |
$default | null |
Returns the raw configuration array
public array getRawConfig ( ) |
Initialize the component
public void init ( ) | ||
throws | \yii\base\InvalidConfigException |
---|
public boolean set ( $key, $value, $section = null, $type = null ) | ||
$key | ||
$value | ||
$section | null | |
$type | null |