-
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
- Behaviors
- SettingsModel
System\Behaviors\SettingsModel
Source: ~/modules/system/behaviors/SettingsModel.php
Extends:
- System\Classes\ModelBehavior
- October\Rain\Database\ModelBehavior
- October\Rain\Extension\ExtensionBase
Settings model extension
Add this the model class definition:
public $implement = ['System.Behaviors.SettingsModel']; public $settingsCode = 'author_plugin_code'; public $settingsFields = 'fields.yaml';
Public properties
There are no public properties in the class.
Show inherited public properties
Inherited public properties
- public static string $extendableStaticCalledClass - defined in October\Rain\Extension\ExtensionBase. The calling class when using a static method.
Protected properties
protected $recordCode
protected $fieldConfig
protected $fieldValues
protected $requiredProperties
Properties that must exist in the model using this behavior.
protected string $configPath
Specifies a path to the config directory.
Show inherited protected properties
Inherited protected properties
- protected October\Rain\Database\Model $model - defined in October\Rain\Database\ModelBehavior. Reference to the extended model.
- protected static array $extensionCallbacks - defined in October\Rain\Extension\ExtensionBase. Used to extend the constructor of an extension class.
- protected $extensionHidden - defined in October\Rain\Extension\ExtensionBase.
Public methods
public void __construct($model)
Constructor
Parameters
- $model
public void afterModelFetch()
Populate the field values from the database record.
public void afterModelSave()
After the model is saved, clear the cached query entry and restart queue workers so they have the latest settings
public void beforeModelSave()
Before the model is saved, ensure the record code is set and the jsonable field values
public static void clearInternalCache()
Clears the internal memory cache of model instances.
public void get($key, $default=NULL)
Helper for getSettingsValue, intended as a static method
Parameters
- $key
- $default
public string getConfigPath(string $fileName, mixed $configPath=NULL)
Locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.
Parameters
- string $fileName - File to load.
- mixed $configPath - Explicitly define a config path.
public void getFieldConfig()
Returns the field configuration used by this model.
public Model getSettingsRecord()
Returns the raw Model record that stores the settings.
public void getSettingsValue($key, $default=NULL)
Get a single setting value, or return a default value
Parameters
- $key
- $default
public string guessConfigPath(string $suffix='')
Guess the package path for the called class.
Parameters
- string $suffix - An extra path to attach to the end
public string guessConfigPathFrom(string $class, string $suffix='')
Guess the package path from a specified class.
Parameters
- string $class - Class to guess path from.
- string $suffix - An extra path to attach to the end
public void initSettingsData()
Default values to set for this model, override
public void instance()
Create an instance of the settings model, intended as a static method
public bool isConfigured()
Checks if the model has been set up previously, intended as a static method
public array|stdClass makeConfig(array $configFile=array(), array $requiredConfig=array())
Reads the contents of the supplied file and applies it to this object.
Parameters
- array $configFile
- array $requiredConfig
public stdClass makeConfigFromArray(array $configArray=array())
Makes a config object from an array, making the first level keys properties of a new object.
Parameters
- array $configArray - Config array.
public stdClass mergeConfig(mixed $configA, mixed $configB)
Merges two configuration sources, either prepared or not, and returns them as a single configuration object.
Parameters
- mixed $configA
- mixed $configB
public void resetDefault()
Reset the settings to their defaults, this will delete the record model
public void saveModelInternal()
Internal save method for the model
public void set($key, $value=NULL)
Set a single or array key pair of values, intended as a static method
Parameters
- $key
- $value
public void setSettingsValue($key, $value)
Set a single setting value, if allowed.
Parameters
- $key
- $value
Inherited public methods
- public static void extend($callback) - defined in October\Rain\Extension\ExtensionBase.
- public void extensionApplyInitCallbacks() - defined in October\Rain\Extension\ExtensionBase.
- public static void extensionExtendCallback(callable $callback) - defined in October\Rain\Extension\ExtensionBase. Helper method for
::extend()
static method. - public void extensionIsHiddenField($name) - defined in October\Rain\Extension\ExtensionBase.
- public void extensionIsHiddenMethod($name) - defined in October\Rain\Extension\ExtensionBase.
- public static void getCalledExtensionClass() - defined in October\Rain\Extension\ExtensionBase.
Protected methods
protected void getCacheKey()
Returns a cache key for this record.
protected void isKeyAllowed($key)
Checks if a key is legitimate or should be added to the field value collection
Parameters
- $key
Show inherited protected methods
Inherited protected methods
- protected void extensionHideField($name) - defined in October\Rain\Extension\ExtensionBase.
- protected void extensionHideMethod($name) - defined in October\Rain\Extension\ExtensionBase.