Theme

This class represents the CMS theme.

 class Cms\Classes\Theme
extends Cms\Classes\CmsObject
implements 
    Cms\Contracts\CmsObject,
    Winter\Storm\Halcyon\ModelInterface,
    ArrayAccess,
    Illuminate\Contracts\Support\Arrayable,
    Illuminate\Contracts\Support\Jsonable,
    JsonSerializable

CMS theme is a directory that contains all CMS objects - pages, layouts, partials and asset files.. The theme parameters are specified in the theme.ini file in the theme root directory.

Traits

Trait Description
Emitter

Adds event related features to any class.

ExtendableTrait

This extension trait is used when access to the underlying base class is not available, such as classes that belong to the foundation framework (Laravel). It is currently used by the Controller and Model classes.

Validation

Constants

Constant Description
ACTIVE_KEY
string "cms::theme.active"
EDIT_KEY
string "cms::theme.edit"

Properties

protected static $activeThemeCache : mixed

Active theme cache in memory

protected $allowedExtensions : array

Allowable file extensions.

protected $configCache : mixed

Keeps the cached configuration file values.

protected $defaultExtension : string

Default file extension.

protected $dirName : string

Specifies the theme directory name.

protected static $editThemeCache : mixed

Edit theme cache in memory

public $attributeNames : array

Inherited from CmsObject

The array of custom attribute names.

public $attributes : array

Inherited from CmsObject

The model's attributes, saved to the settings area.

public $customMessages : array

Inherited from CmsObject

The array of custom error messages.

public $exists : bool

Inherited from CmsObject

Indicates if the model exists.

public $implement : string | array | null

Inherited from CmsObject

Extensions implemented by this class.

public $rules : array

Inherited from CmsObject

The rules to be applied to the data.

protected $appends : array

Inherited from CmsObject

The accessors to append to the model's array form.

protected static $booted : array

Inherited from CmsObject

The array of booted models.

protected static $cache : Illuminate\Cache\CacheManager | null

Inherited from CmsObject

The cache manager instance.

protected $datasource : string | null

Inherited from CmsObject

The data source for the model, a directory path.

protected static $dispatcher : Winter\Storm\Events\Dispatcher | null

Inherited from CmsObject

The event dispatcher instance.

protected $emitterEventCollection : array

Inherited from CmsObject

Collection of registered events.

protected $emitterEventSorted : array

Inherited from CmsObject

Sorted collection of events.

protected $emitterSingleEventCollection : array

Inherited from CmsObject

Collection of registered events to be fired once only.

protected static $eventsBooted : array

Inherited from CmsObject

The array of models booted events.

protected static $extendableCallbacks : array

Inherited from CmsObject

Used to extend the constructor of an extendable class. Eg:

Class::extend(function($obj) { })

protected static $extendableClassLoader : ClassLoader | null

Inherited from CmsObject

Class loader instance.

protected static $extendableGuardProperties : bool

Inherited from CmsObject

Indicates if dynamic properties can be created.

protected static $extendableStaticMethods : array

Inherited from CmsObject

Collection of static methods used by behaviors.

protected $extensionData : array

Inherited from CmsObject

Class reflection information, including behaviors.

protected $fillable : array

Inherited from CmsObject

The attributes that are mass assignable.

protected $isCompoundObject : bool

Inherited from CmsObject

Model supports code and settings sections.

protected $loadedFromCache : bool

Inherited from CmsObject

Indicated whether the object was loaded from the cache.

protected $maxNesting : int

Inherited from CmsObject

The maximum allowed path nesting level. The default value is 2, meaning that files can only exist in the root directory, or in a subdirectory. Set to null if any level is allowed.

protected static $mutatorCache : array

Inherited from CmsObject

The cache of the mutated attributes for each class.

protected $observables : array

Inherited from CmsObject

User exposed observable events.

protected $original : array

Inherited from CmsObject

The model attribute's original state.

protected $purgeable : array

Inherited from CmsObject

List of attribute names which are not considered "settings".

protected static $resolver : Winter\Storm\Halcyon\Datasource\ResolverInterface | null

Inherited from CmsObject

The datasource resolver instance.

protected $themeCache : Cms\Classes\Theme

Inherited from CmsObject

A reference to the CMS theme containing the object.

protected $validationErrors : Illuminate\Support\MessageBag

Inherited from CmsObject

The message bag instance containing validation error messages

protected static $validator : Illuminate\Validation\Validator

Inherited from CmsObject

The validator instance.

protected $wrapCode : bool

Inherited from CmsObject

Wrap code section in PHP tags.

Methods

public __get ($name)

Implements the getter functionality.

Parameters
Property Description
$name
mixed
Returns
mixed

public __isset ($key)

Determine if an attribute exists on the object.

Parameters
Property Description
$key
mixed
Returns
mixed

public static all () : array

Returns an array of all themes.

Returns
array

public assetUrl (string | null $path) : string

Generates an asset URL for the provided path within the theme, will use the parent theme if the current theme does not actually have a directory on the filesystem (i.e. is virtual).

Parameters
Property Description
$path
string | null
Returns
string

public static databaseLayerEnabled () : bool

Checks to see if the database layer has been enabled

Returns
bool

public static exists (string $dirName) : bool

Determines if a theme with given directory name exists

Parameters
Property Description
$dirName
string
Returns
bool

public static getActiveTheme () : self

Returns the active theme object.

If the theme doesn't exist, returns null.

Returns
self

public static getActiveThemeCode () : string

Returns the active theme code.

By default the active theme is loaded from the cms.activeTheme parameter, but this behavior can be overridden by the cms.theme.getActiveTheme event listener. If the theme doesn't exist, returns null.

Returns
string

public getConfig () : array

Reads the theme.yaml file and returns the theme configuration values.

Returns
array

public getConfigArray (string $name) : array

Returns an array value from the theme configuration file by its name.

If the value is a string, it is treated as a YAML file and loaded.

Parameters
Property Description
$name
string
Returns
array

public getConfigValue (string $name, $default = null)

Returns a value from the theme configuration file by its name.

Parameters
Property Description
$name
string
$default
mixed
Returns
mixed

public getCustomData () : Cms\Models\ThemeData

Returns data specific to this theme

Returns
Cms\Models\ThemeData

public getDatasource () : Winter\Storm\Halcyon\Datasource\DatasourceInterface

Get the theme's datasource

Returns
Winter\Storm\Halcyon\Datasource\DatasourceInterface

public getDirName () : string

Returns the theme directory name.

Returns
string

public static getEditTheme () : self

Returns the edit theme.

Returns
self

public static getEditThemeCode () : string

Returns the edit theme code.

By default the edit theme is loaded from the cms.editTheme parameter, but this behavior can be overridden by the cms.theme.getEditTheme event listeners. If the edit theme is not defined in the configuration file, the active theme is returned.

Returns
string

public getFormConfig () : array

Themes have a dedicated form option that provide form fields for customization, this is an immutable accessor for that and also an solid anchor point for extension.

Returns
array

public getId () : string

Helper for {{ theme.id }} twig vars Returns a unique string for this theme.

Returns
string

public getPath ($dirName = null) : string

Returns the absolute theme path.

Parameters
Property Description
$dirName
mixed
Returns
string

public getPreviewImageUrl () : string

Returns the theme preview image URL.

If the image file doesn't exist returns the placeholder image URL.

Returns
string

public hasCustomData () : bool

Returns true if this theme has form fields that supply customization data.

Returns
bool

public isActiveTheme () : bool

Returns true if this theme is the chosen active theme.

Returns
bool

public listPages (boolean $skipCache = false) : Cms\Classes\CmsObjectCollection

Returns a list of pages in the theme.

This method is used internally in the routing process and in the back-end UI.

Parameters
Property Description
$skipCache
boolean
Returns
Cms\Classes\CmsObjectCollection

public static load ($dirName, $file = null) : self

Loads the theme.

Parameters
Property Description
$dirName
mixed
$file
mixed
Returns
self

public registerBackendLocalization () : void

Register the backend localizations provided by this theme and its ancestors.

Returns
void

public registerHalcyonDatasource () : void

Ensures this theme is registered as a Halcyon datasource.

Returns
void

public removeCustomData () : bool

Remove data specific to this theme

Returns
bool

public static resetCache (boolean $memoryOnly = false) : void

Resets any memory or cache involved with the active or edit theme.

Parameters
Property Description
$memoryOnly
boolean
Returns
void

public static setActiveTheme (string $code) : void

Sets the active theme in the database.

The active theme code is stored in the database and overrides the configuration cms.activeTheme parameter.

Parameters
Property Description
$code
string
Returns
void

public setDirName (string $dirName) : void

Sets the theme directory name.

Parameters
Property Description
$dirName
string
Returns
void

public writeConfig (array $values = [], boolean $overwrite = false) : void

Writes to the theme.yaml file with the supplied array values.

Parameters
Property Description
$values
array
$overwrite
boolean
Returns
void

public __call (string $method, array $parameters) : mixed

Inherited from CmsObject

Handle dynamic method calls into the model.

Parameters
Property Description
$method
string
$parameters
array
Returns
mixed

public static __callStatic (string $method, array $parameters) : mixed

Inherited from CmsObject

Handle dynamic static method calls into the method.

Parameters
Property Description
$method
string
$parameters
array
Returns
mixed

public __construct (array $attributes = [])

Inherited from CmsObject
Parameters
Property Description
$attributes
array
Returns
mixed

public __set (string $key, mixed $value) : void

Inherited from CmsObject

Dynamically set attributes on the model.

Parameters
Property Description
$key
string
$value
mixed
Returns
void

public __toString () : string

Inherited from CmsObject

Convert the model to its string representation.

Returns
string

public __unset (string $key) : void

Inherited from CmsObject

Unset an attribute on the model.

Parameters
Property Description
$key
string
Returns
void

public addDynamicMethod (string $dynamicName, callable $method, string $extension = null)

Inherited from CmsObject

Programmatically adds a method to the extendable class

Parameters
Property Description
$dynamicName
string
$method
callable
$extension
string
Returns
mixed

public addDynamicProperty (string $dynamicName, mixed $value = null) : void

Inherited from CmsObject

Programmatically adds a property to the extendable class

Parameters
Property Description
$dynamicName
string

The name of the property to add

$value
mixed

The value of the property

Returns
void

public addObservableEvents (array | mixed $observables) : void

Inherited from CmsObject

Add an observable event name.

Parameters
Property Description
$observables
array | mixed
Returns
void

public addPurgeable (array | string | null $attributes = null) : $this

Inherited from CmsObject

Adds an attribute to the purgeable attributes list

Parameters
Property Description
$attributes
array | string | null
Returns
$this

public asExtension (string $shortName) : mixed

Inherited from CmsObject

Short hand for getClassExtension() method, except takes the short extension name, example:

$this->asExtension('FormController')

Parameters
Property Description
$shortName
string
Returns
mixed

public attributesToArray () : array

Inherited from CmsObject

Convert the model's attributes to an array.

Returns
array

public bindEvent (string | Closure | QueuedClosure $event, mixed $callback = null, integer $priority) : self

Inherited from CmsObject

Create a new event binding.

Parameters
Property Description
$event
string | Closure | QueuedClosure
$callback
mixed

when the third parameter is omitted and a Closure or QueuedClosure is provided this parameter is used as an integer this is used as priority variable

$priority
integer
Returns
self

public bindEventOnce (string | Closure | QueuedClosure $event, QueuedClosure | Closure | null $callback = null) : self

Inherited from CmsObject

Create a new event binding that fires once only

Parameters
Property Description
$event
string | Closure | QueuedClosure
$callback
QueuedClosure | Closure | null

When a Closure or QueuedClosure is provided as the first parameter this parameter can be omitted

Returns
self

public static bootValidation () : void

Inherited from CmsObject

Boot the validation trait for this model.

Returns
void

public static cacheMutatedAttributes (string $class) : void

Inherited from CmsObject

Extract and cache all the mutated attributes of a class.

Parameters
Property Description
$class
string
Returns
void

public static clearBootedModels () : void

Inherited from CmsObject

Clear the list of booted models so they will be re-booted.

Returns
void

public static clearExtendedClasses () : void

Inherited from CmsObject

Clear the list of extended classes so they will be re-extended.

Returns
void

public static create (array $attributes = []) : static

Inherited from CmsObject

Save a new model and return the instance.

Parameters
Property Description
$attributes
array
Returns
static

public static created (Closure | string $callback, integer $priority) : void

Inherited from CmsObject

Register a created model event with the dispatcher.

Parameters
Property Description
$callback
Closure | string
$priority
integer
Returns
void

public static creating (Closure | string $callback, integer $priority) : void

Inherited from CmsObject

Register a creating model event with the dispatcher.

Parameters
Property Description
$callback
Closure | string
$priority
integer
Returns
void

public delete () : bool | null

Inherited from CmsObject

Delete the model from the database.

Returns
bool | null

public static deleted (Closure | string $callback, integer $priority) : void

Inherited from CmsObject

Register a deleted model event with the dispatcher.

Parameters
Property Description
$callback
Closure | string
$priority
integer
Returns
void

public static deleting (Closure | string $callback, integer $priority) : void

Inherited from CmsObject

Register a deleting model event with the dispatcher.

Parameters
Property Description
$callback
Closure | string
$priority
integer
Returns
void

public errors () : Illuminate\Support\MessageBag

Inherited from CmsObject

Get validation error message collection for the Model

Returns
Illuminate\Support\MessageBag

public extendClassWith (string $extensionName) : void

Inherited from CmsObject

Dynamically extend a class with a specified behavior

Parameters
Property Description
$extensionName
string
Returns
void

public static extendableAddExtension (callable $callback, boolean $scoped = false, $outerScope = null) : void

Inherited from CmsObject

Extends the class using a closure.

The closure will be provided a single parameter which is the instance of the extended class, by default.

You may optionally specify the callback as a scoped callback, which inherits the scope of the extended class and provides access to protected and private methods and properties. This makes any call using $this act on the extended class, not the class providing the extension.

If you use a scoped callback, you can provide the "outer" scope - or the scope of the class providing the extension, with the third parameter. The outer scope object will then be passed as the single parameter to the closure.

Parameters
Property Description
$callback
callable
$scoped
boolean
$outerScope
mixed
Returns
void

public extendableCall (string $name, array $params = null) : mixed

Inherited from CmsObject

Magic method for __call().

Callback priority is as follows:

  • "Dynamic Methods" added locally to the object via addDynamicMethod($name, $callable)
  • Methods available on Behaviors that have been implemented by the object
  • Pass it to the parent's __call() method if it defines one
Parameters
Property Description
$name
string
$params
array
Returns
mixed

public static extendableCallStatic (string $name, array $params = null) : mixed

Inherited from CmsObject

Magic method for __callStatic()

Parameters
Property Description
$name
string
$params
array
Returns
mixed

public extendableConstruct ()

Inherited from CmsObject

This method should be called as part of the constructor.

Returns
mixed

public static extendableExtendCallback (callable $callback, boolean $scoped = false, $outerScope = null) : void

Inherited from CmsObject

Helper method for ::extend() static method.

Parameters
Property Description
$callback
callable
$scoped
boolean
$outerScope
mixed
Returns
void

public extendableGet (string $name) : mixed | null

Inherited from CmsObject

Magic method for __get()

Parameters
Property Description
$name
string
Returns
mixed | null

public extendableSet (string $name, mixed $value) : void

Inherited from CmsObject

Magic method for __set()

Parameters
Property Description
$name
string
$value
mixed
Returns
void

public static fetched (Closure | string $callback) : void

Inherited from CmsObject

Create a new native event for handling afterFetch().

Parameters
Property Description
$callback
Closure | string
Returns
void

public static fetching (Closure | string $callback) : void

Inherited from CmsObject

Create a new native event for handling beforeFetch().

Parameters
Property Description
$callback
Closure | string
Returns
void

public fill (array $attributes) : $this

Inherited from CmsObject

Fill the model with an array of attributes.

Parameters
Property Description
$attributes
array
Returns
$this

public fireEvent (string $event, array $params = [], boolean $halt = false) : array | mixed | null

Inherited from CmsObject

Fire an event and call the listeners.

Parameters
Property Description
$event
string

Event name

$params
array

Event parameters

$halt
boolean

Halt after first non-null result

Returns
array | mixed | null

If halted, the first non-null result. If not halted, an array of event results. Returns null if no listeners returned a result.

public static flushDuplicateCache () : void

Inherited from CmsObject

Flush the memory cache.

Returns
void

public static flushEventListeners () : void

Inherited from CmsObject

Remove all of the event listeners for the model.

Returns
void

public forceSave ($options = null) : bool

Inherited from CmsObject

Force save the model even if validation fails.

Parameters
Property Description
$options
mixed
Returns
bool

public getAllowedExtensions () : array

Inherited from CmsObject

Returns the allowable file extensions supported by this model.

Returns
array

public getAttribute (string $key) : mixed

Inherited from CmsObject

Get a plain attribute.

Parameters
Property Description
$key
string
Returns
mixed

public getAttributes () : array

Inherited from CmsObject

Get all of the current attributes on the model.

Returns
array

public getBaseFileName () : string

Inherited from CmsObject

Returns the file name without the extension.

Returns
string

public getBaseFileNameAttribute () : string

Inherited from CmsObject

Returns the file name without the extension.

Returns
string

public static getCacheManager () : Illuminate\Cache\CacheManager | null

Inherited from CmsObject

Get the cache manager instance.

Returns
Illuminate\Cache\CacheManager | null

public getClassExtension (string $name) : mixed

Inherited from CmsObject

Returns a behavior object from an extendable class, example:

$this->getClassExtension('Backend.Behaviors.FormController')

Parameters
Property Description
$name
string

Fully qualified behavior name

Returns
mixed

public getClassMethods () : array

Inherited from CmsObject

Get a list of class methods, extension equivalent of get_class_methods()

Returns
array

public getContent () : string

Inherited from CmsObject

Returns the file content.

Returns
string

public getDatasourceName () : string

Inherited from CmsObject

Get the current datasource name for the model.

Returns
string

public static getDatasourceResolver () : Winter\Storm\Halcyon\Datasource\ResolverInterface

Inherited from CmsObject

Get the datasource resolver instance.

Returns

public getDirty () : array

Inherited from CmsObject

Get the attributes that have been changed since last sync.

Returns
array

public getDynamicProperties () : array

Inherited from CmsObject

Returns all dynamic properties and their values

Returns
array

['property' => 'value']

public static getEventDispatcher () : Winter\Storm\Events\Dispatcher

Inherited from CmsObject

Get the event dispatcher instance.

Returns

public getFileName () : string

Inherited from CmsObject

Returns the file name.

Returns
string

public getFileNameParts ($fileName = null)

Inherited from CmsObject

Returns the base file name and extension. Applies a default extension, if none found.

Parameters
Property Description
$fileName
mixed
Returns
mixed

public getFilePath (string $fileName = null) : string

Inherited from CmsObject

Returns the full path to the template file corresponding to this object.

Parameters
Property Description
$fileName
string
Returns
string

public getIdAttribute () : string

Inherited from CmsObject

Helper for {{ page.id }} or {{ layout.id }} twig vars Returns a semi-unique string for this object.

Returns
string

public getMaxNesting () : int

Inherited from CmsObject

Returns the maximum directory nesting allowed by this template.

Returns
int

public static getModelValidator () : Illuminate\Validation\Validator

Inherited from CmsObject

Get the validator instance.

Returns
Illuminate\Validation\Validator

public getMutatedAttributes () : array

Inherited from CmsObject

Get the mutated attributes for a given instance.

Returns
array

public getObjectTypeDirName () : string

Inherited from CmsObject

Returns the directory name corresponding to the object type.

For pages the directory name is "pages", for layouts - "layouts", etc.

Returns
string

public getObservableEvents () : array

Inherited from CmsObject

Get the observable event names.

Returns
array

public getOriginal (string | null $key = null, mixed $default = null) : array

Inherited from CmsObject

Get the model's original attribute values.

Parameters
Property Description
$key
string | null
$default
mixed
Returns
array

public getSettingsAttribute () : array

Inherited from CmsObject

The settings is attribute contains everything that should be saved to the settings area.

Returns
array

public getThemeAttribute () : Cms\Classes\Theme

Inherited from CmsObject

Returns the CMS theme this object belongs to.

Returns

public getTwigCacheKey () : string

Inherited from CmsObject

Returns the key used by the Twig cache.

Returns
string

public getTwigContent () : string

Inherited from CmsObject

Returns the Twig content string.

Returns
string

public getWrapCode () : bool

Inherited from CmsObject

Returns true if the code section will be wrapped in PHP tags.

Returns
bool

public hasGetMutator (string $key) : bool

Inherited from CmsObject

Determine if a get mutator exists for an attribute.

Parameters
Property Description
$key
string
Returns
bool

public hasSetMutator (string $key) : bool

Inherited from CmsObject

Determine if a set mutator exists for an attribute.

Parameters
Property Description
$key
string
Returns
bool

public static hydrate (array $items, string | null $datasource = null) : Winter\Storm\Halcyon\Collection

Inherited from CmsObject

Create a collection of models from plain arrays.

Parameters
Property Description
$items
array
$datasource
string | null
Returns

public static inTheme (Cms\Classes\Theme $theme) : $this

Inherited from CmsObject

Prepares the theme datasource for the model.

Parameters
Property Description
$theme

Specifies a parent theme.

Returns
$this

public static initCacheItem (mixed $item)

Inherited from CmsObject

Initializes the object properties from the cached data. The extra data set here becomes available as attributes set on the model after fetch.

Parameters
Property Description
$item
mixed
Returns
mixed

public isAttributeRequired (string $attribute) : bool

Inherited from CmsObject

Determines if an attribute is required based on the validation rules.

Parameters
Property Description
$attribute
string
Returns
bool

public isClassExtendedWith (string $name) : bool

Inherited from CmsObject

Check if extendable class is extended with a behavior object

Parameters
Property Description
$name
string

Fully qualified behavior name

Returns
bool

public isCompoundObject () : bool

Inherited from CmsObject

Returns true if this template supports code and settings sections.

Returns
bool

public isDirty (array | string | null $attributes = null) : bool

Inherited from CmsObject

Determine if the model or given attribute(s) have been modified.

Parameters
Property Description
$attributes
array | string | null
Returns
bool

public isFillable (string $key) : bool

Inherited from CmsObject

Determine if the given attribute may be mass assigned.

Parameters
Property Description
$key
string
Returns
bool

public isLoadedFromCache () : bool

Inherited from CmsObject

Returns true if the object was loaded from the cache.

Returns
bool

public jsonSerialize () : array

Inherited from CmsObject

Convert the object into something JSON serializable.

Returns
array

public static listInTheme (Cms\Classes\Theme $theme, boolean $skipCache = false) : CmsObjectCollection

Inherited from CmsObject

Returns the list of objects in the specified theme.

This method is used internally by the system.

Parameters
Property Description
$theme

Specifies a parent theme.

$skipCache
boolean

Indicates if objects should be reloaded from the disk bypassing the cache.

Returns
CmsObjectCollection

Returns a collection of CMS objects.

public static loadCached (Cms\Classes\Theme $theme, string $fileName) : mixed

Inherited from CmsObject

Loads the object from a cache.

This method is used by the CMS in the runtime. If the cache is not found, it is created.

Parameters
Property Description
$theme

Specifies the theme the object belongs to.

$fileName
string

Specifies the file name, with the extension.

Returns
mixed

Returns a CMS object instance or null if the object wasn't found.

public methodExists (string $name) : bool

Inherited from CmsObject

Checks if a method exists, extension equivalent of method_exists()

Parameters
Property Description
$name
string
Returns
bool

public newCollection (array $models = []) : Winter\Storm\Halcyon\Collection

Inherited from CmsObject

Create a new Halcyon Collection instance.

Parameters
Property Description
$models
array
Returns

public newFromBuilder (array $attributes = [], string | null $datasource = null) : static

Inherited from CmsObject

Create a new model instance that is existing.

Parameters
Property Description
$attributes
array
$datasource
string | null
Returns
static

public newInstance (array $attributes = [], boolean $exists = false) : static

Inherited from CmsObject

Create a new instance of the given model.

Parameters
Property Description
$attributes
array
$exists
boolean
Returns
static

public newQuery () : Winter\Storm\Halcyon\Builder

Inherited from CmsObject

Get a new query builder for the object

Returns

public offsetExists (mixed $offset) : bool

Inherited from CmsObject

Determine if the given attribute exists.

Parameters
Property Description
$offset
mixed
Returns
bool

public offsetGet (mixed $offset) : mixed

Inherited from CmsObject

Get the value for a given offset.

Parameters
Property Description
$offset
mixed
Returns
mixed

public offsetSet (mixed $offset, mixed $value) : void

Inherited from CmsObject

Set the value for a given offset.

Parameters
Property Description
$offset
mixed
$value
mixed
Returns
void

public offsetUnset (mixed $offset) : void

Inherited from CmsObject

Unset the value for a given offset.

Parameters
Property Description
$offset
mixed
Returns
void

public static on (string | null $datasource = null) : Winter\Storm\Halcyon\Model

Inherited from CmsObject

Begin querying the model on a given datasource.

Parameters
Property Description
$datasource
string | null
Returns

public propertyExists (string $name) : bool

Inherited from CmsObject

Checks if a property exists, extension equivalent of property_exists()

Parameters
Property Description
$name
string
Returns
bool

public static query () : Winter\Storm\Halcyon\Builder

Inherited from CmsObject

Begin querying the model.

Returns

public removeObservableEvents (array | mixed $observables) : void

Inherited from CmsObject

Remove an observable event name.

Parameters
Property Description
$observables
array | mixed
Returns
void

public static resolveDatasource (string | null $datasource = null) : Winter\Storm\Halcyon\Datasource\DatasourceInterface

Inherited from CmsObject

Resolve a datasource instance.

Parameters
Property Description
$datasource
string | null
Returns

public save (array $options = null) : bool

Inherited from CmsObject

Save the object to the theme.

Parameters
Property Description
$options
array
Returns
bool

public saveInternal (array $options = []) : bool

Inherited from CmsObject

Save the model to the database. Is used by {@link save()} and {@link forceSave()}.

Parameters
Property Description
$options
array
Returns
bool

public static saved (Closure | string $callback, integer $priority) : void

Inherited from CmsObject

Register a saved model event with the dispatcher.

Parameters
Property Description
$callback
Closure | string
$priority
integer
Returns
void

public static saving (Closure | string $callback, integer $priority) : void

Inherited from CmsObject

Register a saving model event with the dispatcher.

Parameters
Property Description
$callback
Closure | string
$priority
integer
Returns
void

public setAttribute (string $key, mixed $value) : $this

Inherited from CmsObject

Set a given attribute on the model.

Parameters
Property Description
$key
string
$value
mixed
Returns
$this

public static setCacheManager (Illuminate\Cache\CacheManager $cache) : void

Inherited from CmsObject

Set the cache manager instance.

Parameters
Property Description
$cache
Illuminate\Cache\CacheManager
Returns
void

public setDatasource (string $name) : $this

Inherited from CmsObject

Set the datasource associated with the model.

Parameters
Property Description
$name
string
Returns
$this

public static setDatasourceResolver (Winter\Storm\Halcyon\Datasource\ResolverInterface $resolver) : void

Inherited from CmsObject

Set the datasource resolver instance.

Parameters
Property Description
$resolver
Winter\Storm\Halcyon\Datasource\ResolverInterface
Returns
void

public static setEventDispatcher (Illuminate\Contracts\Events\Dispatcher $dispatcher) : void

Inherited from CmsObject

Set the event dispatcher instance.

Parameters
Property Description
$dispatcher
Illuminate\Contracts\Events\Dispatcher
Returns
void

public setFileNameAttribute (mixed $value)

Inherited from CmsObject

File name should always contain an extension.

Parameters
Property Description
$value
mixed
Returns
mixed

public setLoadedFromCache ($value) : void

Inherited from CmsObject

Returns true if the object was loaded from the cache.

Parameters
Property Description
$value
mixed
Returns
void

public static setModelValidator ($validator) : void

Inherited from CmsObject

Set the validator instance.

Parameters
Property Description
$validator
mixed
Returns
void

public setObservableEvents (array $observables) : $this

Inherited from CmsObject

Set the observable event names.

Parameters
Property Description
$observables
array
Returns
$this

public setRawAttributes (array $attributes, boolean $sync = false) : $this

Inherited from CmsObject

Set the array of model attributes. No checking is done.

Parameters
Property Description
$attributes
array
$sync
boolean
Returns
$this

public setSettingsAttribute (mixed $value)

Inherited from CmsObject

Filling the settings should merge it with attributes.

Parameters
Property Description
$value
mixed
Returns
mixed

public syncOriginal () : $this

Inherited from CmsObject

Sync the original attributes with the current.

Returns
$this

public syncOriginalAttribute (string $attribute) : $this

Inherited from CmsObject

Sync a single original attribute with its current value.

Parameters
Property Description
$attribute
string
Returns
$this

public toArray () : array

Inherited from CmsObject

Convert the model instance to an array.

Returns
array

public toJson (integer $options) : string

Inherited from CmsObject

Convert the model instance to JSON.

Parameters
Property Description
$options
integer
Returns
string

public unbindEvent (string | array | object $event = null) : self

Inherited from CmsObject

Destroys an event binding.

Parameters
Property Description
$event
string | array | object

Event to destroy

Returns
self

public static unsetCacheManager () : void

Inherited from CmsObject

Unset the cache manager for models.

Returns
void

public static unsetDatasourceResolver () : void

Inherited from CmsObject

Unset the datasource resolver for models.

Returns
void

public static unsetEventDispatcher () : void

Inherited from CmsObject

Unset the event dispatcher for models.

Returns
void

public static unsetModelValidator () : void

Inherited from CmsObject

Unset the validator for models.

Returns
void

public update (array $attributes = []) : bool | int

Inherited from CmsObject

Update the model in the database.

Parameters
Property Description
$attributes
array
Returns
bool | int

public static updated (Closure | string $callback, integer $priority) : void

Inherited from CmsObject

Register an updated model event with the dispatcher.

Parameters
Property Description
$callback
Closure | string
$priority
integer
Returns
void

public static updating (Closure | string $callback, integer $priority) : void

Inherited from CmsObject

Register an updating model event with the dispatcher.

Parameters
Property Description
$callback
Closure | string
$priority
integer
Returns
void

public validate ($rules = null, $customMessages = null, $attributeNames = null) : bool

Inherited from CmsObject

Validate the model instance

Parameters
Property Description
$rules
mixed
$customMessages
mixed
$attributeNames
mixed
Returns
bool

public static validated (Closure | string $callback) : void

Inherited from CmsObject

Create a new native event for handling afterValidate().

Parameters
Property Description
$callback
Closure | string
Returns
void

public static validating (Closure | string $callback) : void

Inherited from CmsObject

Create a new native event for handling beforeValidate().

Parameters
Property Description
$callback
Closure | string
Returns
void

protected static boot () : void

Inherited from CmsObject

The "booting" method of the model.

Returns
void

protected static bootDefaultTheme () : void

Inherited from CmsObject

Boot all of the bootable traits on the model.

Returns
void

protected bootIfNotBooted () : void

Inherited from CmsObject

Check if the model needs to be booted and if so, do it.

Returns
void

protected bootNicerEvents ()

Inherited from CmsObject

Bind some nicer events to this model, in the format of method overrides.

Returns
mixed

protected static bootTraits () : void

Inherited from CmsObject

Boot all of the bootable traits on the model.

Returns
void

protected emitterEventSortEvents (string $eventName) : void

Inherited from CmsObject

Sort the listeners for a given event by priority.

Parameters
Property Description
$eventName
string
Returns
void

protected extendableAddLocalExtension (Closure $callback, $outerScope = null)

Inherited from CmsObject

Adds local extensibility to the current instance.

This rebinds a given closure to the current instance, making it able to access protected and private methods. This makes any call using $this within the closure act on the extended class, not the class providing the extension.

An outer scope may be provided by providing a second parameter, which will then be passed through to the closure as its first parameter. If this is not given, the current instance will be provided as the first parameter.

Parameters
Property Description
$callback
Closure
$outerScope
mixed
Returns
mixed

protected extendableIsAccessible (mixed $class, string $propertyName) : bool

Inherited from CmsObject

Checks if a property is accessible, property equivalent of is_callable()

Parameters
Property Description
$class
mixed
$propertyName
string
Returns
bool

protected extensionExtractMethods (string $extensionName, object $extensionObject) : void

Inherited from CmsObject

Extracts the available methods from a behavior and adds it to the list of callable methods.

Parameters
Property Description
$extensionName
string
$extensionObject
object
Returns
void

protected extensionGetClassLoader () : Winter\Storm\Support\ClassLoader | null

Inherited from CmsObject

Gets the class loader

Returns
Winter\Storm\Support\ClassLoader | null

protected extensionNormalizeClassName (string $name) : string

Inherited from CmsObject

Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes

Parameters
Property Description
$name
string
Returns
string

protected fillableFromArray (array $attributes) : array

Inherited from CmsObject

Get the fillable attributes of a given array.

Parameters
Property Description
$attributes
array
Returns
array

protected finishSave () : void

Inherited from CmsObject

Finish processing on a successful save operation.

Returns
void

protected fireModelEvent (string $event, boolean $halt = true) : mixed

Inherited from CmsObject

Fire the given event for the model.

Parameters
Property Description
$event
string
$halt
boolean
Returns
mixed

protected getArrayableAppends () : array

Inherited from CmsObject

Get all of the appendable values that are arrayable.

Returns
array

protected getAttributeFromArray (string $key) : mixed

Inherited from CmsObject

Get an attribute from the $attributes array.

Parameters
Property Description
$key
string
Returns
mixed

protected getValidationAttributes () : array

Inherited from CmsObject

Returns the model data used for validation.

Returns
array

protected static makeValidator ($data, $rules, $customMessages, $attributeNames) : Illuminate\Validation\Validator

Inherited from CmsObject

Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel.

Parameters
Property Description
$data
mixed
$rules
mixed
$customMessages
mixed
$attributeNames
mixed
Returns
Illuminate\Validation\Validator

protected mutateAttribute (string $key, mixed $value) : mixed

Inherited from CmsObject

Get the value of an attribute using its mutator.

Parameters
Property Description
$key
string
$value
mixed
Returns
mixed

protected mutateAttributeForArray (string $key, mixed $value) : mixed

Inherited from CmsObject

Get the value of an attribute using its mutator for array conversion.

Parameters
Property Description
$key
string
$value
mixed
Returns
mixed

protected originalIsNumericallyEquivalent (string $key) : bool

Inherited from CmsObject

Determine if the new and old values for a given key are numerically equivalent.

Parameters
Property Description
$key
string
Returns
bool

protected parseEventAndPayload (mixed $event, mixed $payload = null) : array

Inherited from CmsObject

Parse the given event and payload and prepare them for dispatching.

Parameters
Property Description
$event
mixed
$payload
mixed
Returns
array

protected performDeleteOnModel () : void

Inherited from CmsObject

Perform the actual delete query on this model instance.

Returns
void

protected performInsert (Winter\Storm\Halcyon\Builder $query) : bool

Inherited from CmsObject

Perform a model insert operation.

Parameters
Property Description
$query
Winter\Storm\Halcyon\Builder
Returns
bool

protected performUpdate (Winter\Storm\Halcyon\Builder $query) : bool

Inherited from CmsObject

Perform a model update operation.

Parameters
Property Description
$query
Winter\Storm\Halcyon\Builder
Returns
bool

protected processRuleFieldNames (array $rules) : array

Inherited from CmsObject

Processes field names in a rule array.

Converts any field names using array notation (ie. field[child]) into dot notation (ie. field.child)

Parameters
Property Description
$rules
array

Rules array

Returns
array

protected processValidationRules ($rules)

Inherited from CmsObject

Process rules

Parameters
Property Description
$rules
mixed
Returns
mixed

protected static registerModelEvent (string $event, Closure | string $callback, integer $priority) : void

Inherited from CmsObject

Register a model event with the dispatcher.

Parameters
Property Description
$event
string
$callback
Closure | string
$priority
integer
Returns
void

protected throwHalcyonSaveException (Exception $ex)

Inherited from CmsObject

Converts an exception type thrown by Halcyon to a native CMS exception.

Parameters
Property Description
$ex
Exception
Returns
mixed
Copyright © 2024 Winter CMS