-
Docs
Backend
-
Behaviors
-
Classes
-
Controllers
-
Database
-
Seeds
-
-
Facades
-
FormWidgets
-
Helpers
-
Exception
- Backend
-
-
Models
-
ReportWidgets
-
Skins
-
Traits
-
Widgets
- ServiceProvider
-
-
Cms
-
Classes
- Asset
- AutoDatasource
- CmsCompoundObject
- CmsController
- CmsException
- CmsObject
- CmsObjectCollection
- CodeBase
- CodeParser
- ComponentBase
- ComponentHelpers
- ComponentManager
- ComponentPartial
- Content
- Controller
- Layout
- LayoutCode
- MediaLibrary
- MediaLibraryItem
- MediaViewHelper
- Meta
- ObjectMemoryCache
- Page
- PageCode
- Partial
- PartialCode
- PartialStack
- Router
- Theme
- ThemeManager
-
Components
-
Contracts
-
Controllers
-
Facades
-
FormWidgets
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ComponentNode
- ComponentTokenParser
- ContentNode
- ContentTokenParser
- DebugExtension
- DefaultNode
- DefaultTokenParser
- Extension
- FlashNode
- FlashTokenParser
- FrameworkNode
- FrameworkTokenParser
- Loader
- PageNode
- PageTokenParser
- PartialNode
- PartialTokenParser
- PlaceholderNode
- PlaceholderTokenParser
- PutNode
- PutTokenParser
- ScriptsNode
- ScriptsTokenParser
- StylesNode
- StylesTokenParser
-
Widgets
- ServiceProvider
-
-
System
-
Behaviors
-
Classes
-
Console
-
Controllers
-
Database
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ServiceProvider
-
-
Events
-
backend
-
ajax
-
filter
-
form
-
list
-
menu
-
page
-
user
-
-
cms
-
ajax
-
block
-
combiner
-
component
-
object
-
page
-
router
-
template
-
theme
-
-
halcyon
-
datasource
-
-
mailer
-
media
-
model
-
system
-
assets
-
console
-
mirror
-
theme
-
-
reportwidgets
-
settings
- extendConfigFile
-
-
translator
-
-
Library
-
Argon
-
Auth
-
Models
- AuthException
- Manager
-
-
Config
-
Cookie
-
Middleware
-
-
Database
-
Attach
-
Behaviors
-
Concerns
-
Connections
-
Connectors
-
Models
-
Relations
-
Schema
-
Traits
-
Updates
- README
- Builder
- Collection
- DatabaseServiceProvider
- DataFeed
- Dongle
- MemoryCache
- Model
- ModelBehavior
- ModelException
- NestedTreeScope
- Pivot
- QueryBuilder
- SortableScope
- TreeCollection
- Updater
-
-
Events
-
Exception
-
Extension
-
Filesystem
-
Flash
-
Foundation
-
Bootstrap
-
Console
-
Exception
-
Http
-
Middleware
- Kernel
-
-
Providers
- Application
- Maker
-
-
Halcyon
-
Datasource
-
Exception
-
Processors
-
Traits
- README
- Builder
- Collection
- HalcyonServiceProvider
- MemoryCacheManager
- MemoryRepository
- Model
-
-
Html
-
Mail
-
Network
-
Parse
-
Router
-
Scaffold
-
Support
-
Translation
-
- Documentation
- API
- System
- Classes
- SettingsManager
System\Classes\SettingsManager
Source: ~/modules/system/classes/SettingsManager.php
Manages the system settings.
Protected properties
protected array $callbacks
Cache of registration callbacks.
protected array $items
List of registered items.
protected array $groupedItems
Grouped collection of all items, by category.
protected string $contextOwner
Active plugin or module owner.
protected string $contextItemCode
Active item code.
protected static array $itemDefaults
Settings item defaults.
protected System\Classes\PluginManager $pluginManager
protected static $instance
Public methods
public void __clone()
public void __wakeup()
public void addSettingItem(string $owner, string $code, array $definitions)
Dynamically add a single setting item
Parameters
- string $owner
- string $code
- array $definitions
public void addSettingItems(string $owner, array $definitions)
Dynamically add an array of setting items
Parameters
- string $owner
- array $definitions
public mixed findSettingItem(string $owner, string $code)
Locates a setting item object by it's owner and code
Parameters
- string $owner
- string $code
public static void forgetInstance()
Forget this singleton's instance if it exists
public mixed getContext()
Returns information about the current settings context.
public static void instance()
Create a new instance of this singleton.
public array listItems(string $context=NULL)
Returns a collection of all settings by group, filtered by context
Parameters
- string $context
public void 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([...]); });
Parameters
- callable $callback - A callable function.
public void 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.
Parameters
- string $owner - Specifies the setting items owner plugin or module in the format Vendor.Module.
- array $definitions - An array of the setting item definitions.
public void removeSettingItem($owner, $code)
Removes a single setting item
Parameters
- $owner
- $code
public static void setContext(string $owner, string $code)
Sets the navigation context.
Parameters
- string $owner - Specifies the setting items owner plugin or module in the format Vendor.Module.
- string $code - Specifies the settings item code.
Protected methods
protected void __construct()
Constructor.
protected array filterByContext(array $items, string $context)
Filters a set of items by a given context.
Parameters
- array $items
- string $context
protected array filterItemPermissions(User $user, array $items)
Removes settings items from an array if the supplied user lacks permission.
Parameters
- User $user - A user object
- array $items - A collection of setting items
protected void init()
Initialize this singleton.
protected void loadItems()
protected string makeItemKey(object $item, $code)
Internal method to make a unique key for an item.
Parameters
- object $item
- $code