SettingsManager
        
        Manages the system settings.
    
    
 class System\Classes\SettingsManagerTraits
| Trait | Description | 
|---|---|
| LazyOwnerAlias | Lazy Owner Alias Adds support for statically binding owner aliases | 
| Singleton | Singleton trait. | 
Constants
| Constant | Type | Value | Description | 
|---|---|---|---|
| CATEGORY_BACKEND | string | "system::lang.system.categories.backend" | 
                                                            string
                                                         "system::lang.system.categories.backend" | 
| CATEGORY_CMS | string | "system::lang.system.categories.cms" | 
                                                            string
                                                         "system::lang.system.categories.cms"Allocated category types | 
| CATEGORY_CUSTOMERS | string | "system::lang.system.categories.customers" | 
                                                            string
                                                         "system::lang.system.categories.customers" | 
| CATEGORY_EVENTS | string | "system::lang.system.categories.events" | 
                                                            string
                                                         "system::lang.system.categories.events" | 
| CATEGORY_LOGS | string | "system::lang.system.categories.logs" | 
                                                            string
                                                         "system::lang.system.categories.logs" | 
| CATEGORY_MAIL | string | "system::lang.system.categories.mail" | 
                                                            string
                                                         "system::lang.system.categories.mail" | 
| CATEGORY_MISC | string | "system::lang.system.categories.misc" | 
                                                            string
                                                         "system::lang.system.categories.misc" | 
| CATEGORY_MYSETTINGS | string | "system::lang.system.categories.my_settings" | 
                                                            string
                                                         "system::lang.system.categories.my_settings" | 
| CATEGORY_NOTIFICATIONS | string | "system::lang.system.categories.notifications" | 
                                                            string
                                                         "system::lang.system.categories.notifications" | 
| CATEGORY_SHOP | string | "system::lang.system.categories.shop" | 
                                                            string
                                                         "system::lang.system.categories.shop" | 
| CATEGORY_SOCIAL | string | "system::lang.system.categories.social" | 
                                                            string
                                                         "system::lang.system.categories.social" | 
| CATEGORY_SYSTEM | string | "system::lang.system.categories.system" | 
                                                            string
                                                         "system::lang.system.categories.system" | 
| CATEGORY_TEAM | string | "system::lang.system.categories.team" | 
                                                            string
                                                         "system::lang.system.categories.team" | 
| CATEGORY_USERS | string | "system::lang.system.categories.users" | 
                                                            string
                                                         "system::lang.system.categories.users" | 
Properties
            
            
            
                protected
            
            
            $aliases
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
        
        List of owner aliases. ['Aliased.Owner' => 'Real.Owner']
            
            
            
                protected
            
            
            $callbacks
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
        
        Cache of registration callbacks.
protected $contextItemCode : string
Active item code.
protected $contextOwner : string
Active plugin or module owner.
protected $groupedItems : array
Grouped collection of all items, by category.
            
            
            
                protected
            
                            
                    static
                
            
            $itemDefaults
            
                :
                                                            array
                                                                        
                        = {"code":null,"label":null,"category":null,"icon":null,"url":null,"permissions":[],"order":500,"context":"system","keywords":null}
                    
                            
        
        
        Settings item defaults.
protected $items : array
List of registered items.
protected $pluginManager : System\Classes\PluginManager
            
                            
                    inherited
                
            
            
                protected
            
                            
                    static
                
            
            $lazyAliases
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
                    List of aliases
Methods
public addSettingItem (string $owner, string $code, array $definition)
Dynamically add a single setting item
| Property | Type | Description | 
|---|---|---|
| $owner | string | string | 
| $code | string | string | 
| $definition | array | array | 
public addSettingItems (string $owner, array $definitions)
Dynamically add an array of setting items
| Property | Type | Description | 
|---|---|---|
| $owner | string | string | 
| $definitions | array | array | 
public findSettingItem (string $owner, string $code) : mixed
Locates a setting item object by it's owner and code
| Property | Type | Description | 
|---|---|---|
| $owner | string | string | 
| $code | string | string | 
The item object or FALSE if nothing is found
public getContext () : mixed
Returns information about the current settings context.
Returns an object with the following fields:
- itemCode
- owner
            
            
            
                public
            
                        
            listItems (string $context = null)
                            : array
                    
        
        Returns a collection of all settings by group, filtered by context
| Property | Type | Description | 
|---|---|---|
| $context | string | string | 
public registerCallback (callable $callback)
Registers a callback function that defines setting items.
The callback function should register setting items by calling the manager's registerSettingItems() function. The manager instance is passed to the callback function as an argument. Usage:
SettingsManager::registerCallback(function ($manager) {
    $manager->registerSettingItems([...]);
});
| Property | Type | Description | 
|---|---|---|
| $callback | callable | callable A callable function. | 
public registerOwnerAlias (string $owner, string $alias) : void
Register an owner alias
| Property | Type | Description | 
|---|---|---|
| $owner | string | string The owner to register an alias for. Example: Real.Owner | 
| $alias | string | string The alias to register. Example: Aliased.Owner | 
public registerSettingItems (string $owner, array $definitions)
Registers the back-end setting items.
The argument is an array of the settings items. The array keys represent the setting item codes, specific for the plugin/module. Each element in the array should be an associative array with the following keys:
- label - specifies the settings label localization string key, required.
- icon - an icon name from the Font Awesome icon collection, required.
- url - the back-end relative URL the setting item should point to.
- class - the back-end relative URL the setting item should point to.
- permissions - an array of permissions the back-end user should have, optional. The item will be displayed if the user has any of the specified permissions.
- order - a position of the item in the setting, optional.
- category - a string to assign this item to a category, optional.
| Property | Type | Description | 
|---|---|---|
| $owner | string | string Specifies the setting items owner plugin or module in the format Vendor.Module. | 
| $definitions | array | array An array of the setting item definitions. | 
public removeSettingItem ($owner, $code)
Removes a single setting item
| Property | Type | Description | 
|---|---|---|
| $owner | mixed | mixed | 
| $code | mixed | mixed | 
public static setContext (string $owner, string $code)
Sets the navigation context.
| Property | Type | Description | 
|---|---|---|
| $owner | string | string Specifies the setting items owner plugin or module in the format Vendor.Module. | 
| $code | string | string Specifies the settings item code. | 
protected filterByContext (array $items, string $context) : array
Filters a set of items by a given context.
| Property | Type | Description | 
|---|---|---|
| $items | array | array | 
| $context | string | string | 
protected filterItemPermissions (User $user, array $items) : array
Removes settings items from an array if the supplied user lacks permission.
| Property | Type | Description | 
|---|---|---|
| $user | User | User A user object | 
| $items | array | array A collection of setting items | 
The filtered settings items
protected init ()
Initialize this singleton.
protected loadItems ()
protected makeItemKey ($owner, $code) : string
Internal method to make a unique key for an item.
| Property | Type | Description | 
|---|---|---|
| $owner | mixed | mixed | 
| $code | mixed | mixed | 
inherited public __clone ()
inherited public __wakeup ()
            
                            
                    inherited
                
            
            
                public
            
                            
                    static
                
                                        
                    final
                
            
            forgetInstance ($container = null)
                            : void
                    
                    Forget this singleton's instance if it exists
| Property | Type | Description | 
|---|---|---|
| $container | mixed | mixed | 
            
                            
                    inherited
                
            
            
                public
            
                            
                    static
                
                                        
                    final
                
            
            instance ($container = null)
                            : static
                    
                    Create a new instance of this singleton.
| Property | Type | Description | 
|---|---|---|
| $container | mixed | mixed | 
inherited public static lazyRegisterOwnerAlias (string $owner, string $alias) : void
Binds the alias of an owner to the lazy alias list. This allows us to bind aliases
prior to init() which is necessary to do before to PluginManager being registered.
| Property | Type | Description | 
|---|---|---|
| $owner | string | string | 
| $alias | string | string | 
inherited protected final __construct ()
Constructor.