Page
The CMS page class.
class Cms\Classes\Page
extends Cms\Classes\CmsCompoundObject
implements
Cms\Contracts\CmsObject,
Winter\Storm\Halcyon\ModelInterface,
ArrayAccess,
Illuminate\Contracts\Support\Arrayable,
Illuminate\Contracts\Support\Jsonable,
JsonSerializable
Extends
Class | Description |
---|---|
CmsCompoundObject
|
This is a base class for CMS objects that have multiple sections - pages, partials and layouts. |
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
|
Properties
public
$apiBag
:
array
= []
The API bag allows the API handler code to bind arbitrary data to the page object.
public
$rules
:
array
= {"title":"required","url":["required","regex:\/^\\\/[a-z0-9\\\/\\:_\\-\\*\\[\\]\\+\\?\\|\\.\\^\\\\$]*$\/i"]}
The rules to be applied to the data.
protected
$dirName
:
string
= "pages"
The container name associated with the model, eg: pages.
protected
$fillable
:
array
= ["url","layout","title","description","is_hidden","meta_title","meta_description","markup","settings","code"]
The attributes that are mass assignable.
inherited
public
$attributeNames
:
array
= []
The array of custom attribute names.
inherited
public
$attributes
:
array
= []
The model's attributes, saved to the settings area.
inherited
public
$components
:
array
= []
Initialized components defined in the template file.
inherited
public
$customMessages
:
array
= []
The array of custom error messages.
inherited
public
$exists
:
bool
= false
Indicates if the model exists.
inherited
public
$implement
:
string
|
array
|
null
= null
Extensions implemented by this class.
inherited
public
$settings
:
array
= {"components":[]}
INI settings defined in the template file. Not to be confused with the attribute called settings. In this array, components are bumped to their own array inside the 'components' key.
inherited
public
$viewBag
:
array
= []
Contains the view bag properties. This property is used by the page editor internally.
inherited
protected
$allowedExtensions
:
array
= ["htm"]
Allowable file extensions.
inherited
protected
$appends
:
array
= []
The accessors to append to the model's array form.
inherited
protected
static
$booted
:
array
= []
The array of booted models.
inherited protected static $cache : Illuminate\Cache\CacheManager | null
The cache manager instance.
inherited protected $datasource : string | null
The data source for the model, a directory path.
inherited
protected
$defaultExtension
:
string
= "htm"
Default file extension.
inherited protected static $dispatcher : Winter\Storm\Events\Dispatcher | null
The event dispatcher instance.
inherited
protected
$emitterEventCollection
:
array
= []
Collection of registered events.
inherited
protected
$emitterEventSorted
:
array
= []
Sorted collection of events.
inherited
protected
$emitterSingleEventCollection
:
array
= []
Collection of registered events to be fired once only.
inherited
protected
static
$eventsBooted
:
array
= []
The array of models booted events.
inherited
protected
static
$extendableCallbacks
:
array
= []
Used to extend the constructor of an extendable class. Eg:
Class::extend(function($obj) { })
inherited
protected
static
$extendableClassLoader
:
ClassLoader
|
null
= null
Class loader instance.
inherited
protected
$extendableConstructed
:
bool
= false
Indicates if the extendable constructor has completed.
inherited
protected
static
$extendableStaticMethods
:
array
= []
Collection of static methods used by behaviors.
inherited
protected
$extensionData
:
array
= {"extensions":[],"methods":[],"dynamicMethods":[],"dynamicProperties":[]}
Class reflection information, including behaviors.
inherited
protected
$isCompoundObject
:
bool
= true
Model supports code and settings sections.
inherited
protected
$loadedFromCache
:
bool
= false
Indicated whether the object was loaded from the cache.
inherited
protected
$localCallbacks
:
array
= []
This stores any locally-scoped callbacks fired before the extendable constructor had completed.
inherited
protected
$maxNesting
:
int
= null
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.
inherited
protected
static
$mutatorCache
:
array
= []
The cache of the mutated attributes for each class.
inherited protected static $objectComponentPropertyMap : array | null
Cache for component properties.
inherited
protected
$observables
:
array
= []
User exposed observable events.
inherited
protected
$original
:
array
= []
The model attribute's original state.
inherited
protected
$passthru
:
array
= ["lists","where","sortBy","whereComponent","withComponent"]
The methods that should be returned from the collection of all objects.
inherited
protected
$purgeable
:
array
= []
List of attribute names which are not considered "settings".
inherited protected static $resolver : Winter\Storm\Halcyon\Datasource\ResolverInterface | null
The datasource resolver instance.
inherited protected $themeCache : Cms\Classes\Theme
A reference to the CMS theme containing the object.
inherited protected $validationErrors : Illuminate\Support\MessageBag
The message bag instance containing validation error messages
inherited protected static $validator : Illuminate\Validation\Validator
The validator instance.
inherited
protected
$viewBagCache
:
mixed
= false
Cache store for the getViewBag method.
inherited
protected
$wrapCode
:
bool
= true
Wrap code section in PHP tags.
Methods
public
__construct (array $attributes = []
)
Creates an instance of the object and associates it with a CMS theme.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
public getCodeClassParent () : mixed
Returns name of a PHP class to us a parent for the PHP class created for the object's PHP section.
Returns the class name or null.
public getLayoutOptions () : array
Returns a list of layouts available in the theme.
This method is used by the form widget.
Returns an array of strings.
public static getMenuTypeInfo (string $type) : array
Handler for the pages.menuitem.getTypeInfo event.
Returns a menu item type information. The type information is returned as array with the following elements:
- references - a list of the item type reference options. The options are returned in the ["key"] => "title" format for options that don't have sub-options, and in the format ["key"] => ["title"=>"Option title", "items"=>[...]] for options that have sub-options. Optional, required only if the menu item type requires references.
- nesting - Boolean value indicating whether the item type supports nested items. Optional, false if omitted.
- dynamicItems - Boolean value indicating whether the item type could generate new menu items. Optional, false if omitted.
- cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to resolve the item URL.
Property | Type | Description |
---|---|---|
$type | string |
string
Specifies the menu item type |
Returns an array
public static getNameList () : array
Helper that returns a nicer list of pages for use in dropdowns.
public static getRichEditorTypeInfo (string $type) : array
Handler for the backend.richeditor.getTypeInfo event.
Returns a menu item type information. The type information is returned as array
Property | Type | Description |
---|---|---|
$type | string |
string
Specifies the page link type |
public static resolveMenuItem (object $item, string $url, Cms\Classes\Theme $theme) : array | null
Handler for the pages.menuitem.resolveItem event.
Returns information about a menu item. The result is an array with the following keys:
- url - the menu item URL. Not required for menu item types that return all available records. The URL should be returned relative to the website root and include the subdirectory, if any. Use the Url::to() helper to generate the URLs.
- isActive - determines whether the menu item is active. Not required for menu item types that return all available records.
- items - an array of arrays with the same keys (url, isActive, items) + the title key. The items array should be added only if the $item's $nesting property value is TRUE.
Property | Type | Description |
---|---|---|
$item | object |
object
Specifies the menu item. |
$url | string |
string
|
$theme | Cms\Classes\Theme |
Cms\Classes\Theme
|
public
static
url (mixed $page, array $params = []
)
: string | null
Helper that makes a URL for a page in the active theme.
Property | Type | Description |
---|---|---|
$page | mixed |
mixed
Specifies the Cms Page file name. |
$params | array |
array
Route parameters to consider in the URL. |
inherited public __call (string $method, array $parameters) : mixed
Dynamically handle calls into the query instance.
Property | Type | Description |
---|---|---|
$method | string |
string
|
$parameters | array |
array
|
inherited public static __callStatic (string $method, array $parameters) : mixed
Handle dynamic static method calls into the method.
Property | Type | Description |
---|---|---|
$method | string |
string
|
$parameters | array |
array
|
inherited public __get ($name)
Implements getter functionality for visible properties defined in the settings section or view bag array.
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
inherited public __isset (string $key) : bool
Determine if an attribute exists on the object.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited public __set (string $key, mixed $value) : void
Dynamically set attributes on the model.
Property | Type | Description |
---|---|---|
$key | string |
string
|
$value | mixed |
mixed
|
inherited public __toString () : string
Convert the model to its string representation.
inherited public __unset (string $key) : void
Unset an attribute on the model.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited
public
addDynamicMethod (string $dynamicName, callable $method, string $extension = null
)
Programmatically adds a method to the extendable class
Property | Type | Description |
---|---|---|
$dynamicName | string |
string
|
$method | callable |
callable
|
$extension | string |
string
|
inherited
public
addDynamicProperty (string $dynamicName, mixed $value = null
)
: void
Programmatically adds a property to the extendable class
Property | Type | Description |
---|---|---|
$dynamicName | string |
string
The name of the property to add |
$value | mixed |
mixed
The value of the property |
inherited public addObservableEvents (array | mixed $observables) : void
Add an observable event name.
Property | Type | Description |
---|---|---|
$observables | array | mixed |
array | mixed
|
inherited
public
addPurgeable (array | string | null $attributes = null
)
: $this
Adds an attribute to the purgeable attributes list
Property | Type | Description |
---|---|---|
$attributes | array | string | null |
array | string | null
|
inherited public afterFetch () : void
Triggered after the object is loaded.
inherited public static all () : Winter\Storm\Halcyon\Collection
inherited public asExtension (string $shortName) : mixed
Short hand for getClassExtension()
method, except takes the short
extension name, example:
$this->asExtension('FormController')
Property | Type | Description |
---|---|---|
$shortName | string |
string
|
inherited public attributesToArray () : array
Convert the model's attributes to an array.
inherited public beforeSave () : void
Triggered when the model is saved.
inherited
public
bindEvent (string | Closure | QueuedClosure $event, mixed $callback = null
, integer $priority)
: self
Create a new event binding.
Property | Type | Description |
---|---|---|
$event | string | Closure | QueuedClosure |
string | Closure | QueuedClosure
|
$callback | mixed |
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 |
integer
|
inherited
public
bindEventOnce (string | Closure | QueuedClosure $event, QueuedClosure | Closure | null $callback = null
)
: self
Create a new event binding that fires once only
Property | Type | Description |
---|---|---|
$event | string | Closure | QueuedClosure |
string | Closure | QueuedClosure
|
$callback | QueuedClosure | Closure | null |
QueuedClosure | Closure | null
When a Closure or QueuedClosure is provided as the first parameter this parameter can be omitted |
inherited public static bootValidation () : void
Boot the validation trait for this model.
inherited public static cacheMutatedAttributes (string $class) : void
Extract and cache all the mutated attributes of a class.
Property | Type | Description |
---|---|---|
$class | string |
string
|
inherited public static clearBootedModels () : void
Clear the list of booted models so they will be re-booted.
inherited public static clearCache (Cms\Classes\Theme $theme) : void
Clears the object cache.
Property | Type | Description |
---|---|---|
$theme | Cms\Classes\Theme |
Specifies a parent theme. |
inherited public static clearExtendedClasses () : void
Clear the list of extended classes so they will be re-extended.
inherited
public
static
create (array $attributes = []
)
: static
Save a new model and return the instance.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
inherited public static created (Closure | string $callback, integer $priority) : void
Register a created model event with the dispatcher.
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
$priority | integer |
integer
|
inherited public static creating (Closure | string $callback, integer $priority) : void
Register a creating model event with the dispatcher.
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
$priority | integer |
integer
|
inherited public delete () : bool | null
Delete the model from the database.
inherited public static deleted (Closure | string $callback, integer $priority) : void
Register a deleted model event with the dispatcher.
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
$priority | integer |
integer
|
inherited public static deleting (Closure | string $callback, integer $priority) : void
Register a deleting model event with the dispatcher.
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
$priority | integer |
integer
|
inherited public errors () : Illuminate\Support\MessageBag
Get validation error message collection for the Model
inherited public extendClassWith (string $extensionName) : void
Dynamically extend a class with a specified behavior
Property | Type | Description |
---|---|---|
$extensionName | string |
string
|
inherited
public
static
extendableAddExtension (callable $callback, boolean $scoped = false
, $outerScope = null
)
: void
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.
Property | Type | Description |
---|---|---|
$callback | callable |
callable
|
$scoped | boolean |
boolean
|
$outerScope | mixed |
mixed
|
inherited
public
extendableCall (string $name, array $params = null
)
: mixed
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
Property | Type | Description |
---|---|---|
$name | string |
string
|
$params | array |
array
|
inherited
public
static
extendableCallStatic (string $name, array $params = null
)
: mixed
Magic method for __callStatic()
Property | Type | Description |
---|---|---|
$name | string |
string
|
$params | array |
array
|
inherited public extendableConstruct ()
This method should be called as part of the constructor.
inherited
public
static
extendableExtendCallback (callable $callback, boolean $scoped = false
, $outerScope = null
)
: void
Helper method for ::extend()
static method.
Property | Type | Description |
---|---|---|
$callback | callable |
callable
|
$scoped | boolean |
boolean
|
$outerScope | mixed |
mixed
|
inherited public extendableGet (string $name) : mixed | null
Magic method for __get()
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited public extendableSet (string $name, mixed $value) : void
Magic method for __set()
Property | Type | Description |
---|---|---|
$name | string |
string
|
$value | mixed |
mixed
|
inherited public static fetched (Closure | string $callback) : void
Create a new native event for handling afterFetch().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
inherited public static fetching (Closure | string $callback) : void
Create a new native event for handling beforeFetch().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
inherited public fill (array $attributes) : $this
Fill the model with an array of attributes.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
inherited
public
fireEvent (string $event, array $params = []
, boolean $halt = false
)
: array | mixed | null
Fire an event and call the listeners.
Property | Type | Description |
---|---|---|
$event | string |
string
Event name |
$params | array |
array
Event parameters |
$halt | boolean |
boolean
Halt after first non-null result |
If halted, the first non-null result. If not halted, an array of event results. Returns null if no listeners returned a result.
inherited public static flushDuplicateCache () : void
Flush the memory cache.
inherited public static flushEventListeners () : void
Remove all of the event listeners for the model.
inherited
public
forceSave ($options = null
)
: bool
Force save the model even if validation fails.
Property | Type | Description |
---|---|---|
$options | mixed |
mixed
|
inherited public getAllowedExtensions () : array
Returns the allowable file extensions supported by this model.
inherited public getAttribute (string $key) : mixed
Get a plain attribute.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited public getAttributes () : array
Get all of the current attributes on the model.
inherited public getBaseFileName () : string
Returns the file name without the extension.
inherited public getBaseFileNameAttribute () : string
Returns the file name without the extension.
inherited public static getCacheManager () : Illuminate\Cache\CacheManager | null
Get the cache manager instance.
inherited public getClassExtension (string $name) : mixed
Returns a behavior object from an extendable class, example:
$this->getClassExtension('Backend.Behaviors.FormController')
Property | Type | Description |
---|---|---|
$name | string |
string
Fully qualified behavior name |
inherited public getClassMethods () : array
Get a list of class methods, extension equivalent of get_class_methods()
inherited public getComponent (string $componentName) : Cms\Classes\ComponentBase
Returns a component by its name.
This method is used only in the back-end and for internal system needs when the standard way to access components is not an option.
Property | Type | Description |
---|---|---|
$componentName | string |
string
Specifies the component name. |
Returns the component instance or null.
inherited public getComponentProperties (string $componentName) : array
Returns component property names and values.
This method implements caching and can be used in the run-time on the front-end.
Property | Type | Description |
---|---|---|
$componentName | string |
string
Specifies the component name. |
Returns an associative array with property names in the keys and property values in the values.
inherited public getContent () : string
Returns the file content.
inherited public getDatasource () : Winter\Storm\Halcyon\Datasource\DatasourceInterface
inherited public getDatasourceName () : string
Get the current datasource name for the model.
inherited public static getDatasourceResolver () : Winter\Storm\Halcyon\Datasource\ResolverInterface
inherited public getDirty () : array
Get the attributes that have been changed since last sync.
inherited public getDynamicProperties () : array
Returns all dynamic properties and their values
['property' => 'value']
inherited public static getEventDispatcher () : Winter\Storm\Events\Dispatcher
inherited public getFileName () : string
Returns the file name.
inherited
public
getFileNameParts ($fileName = null
)
Returns the base file name and extension. Applies a default extension, if none found.
Property | Type | Description |
---|---|---|
$fileName | mixed |
mixed
|
inherited
public
getFilePath (string $fileName = null
)
: string
Returns the full path to the template file corresponding to this object.
Property | Type | Description |
---|---|---|
$fileName | string |
string
|
inherited public getId () : string
Helper for {{ page.id }} or {{ layout.id }} twig vars Returns a unique string for this object.
inherited public getIdAttribute () : string
Helper for {{ page.id }} or {{ layout.id }} twig vars Returns a semi-unique string for this object.
inherited public getMaxNesting () : int
Returns the maximum directory nesting allowed by this template.
inherited public static getModelValidator () : Illuminate\Validation\Validator
Get the validator instance.
inherited public getMutatedAttributes () : array
Get the mutated attributes for a given instance.
inherited public getObjectTypeDirName () : string
Returns the directory name corresponding to the object type.
For pages the directory name is "pages", for layouts - "layouts", etc.
inherited public getObservableEvents () : array
Get the observable event names.
inherited
public
getOriginal (string | null $key = null
, mixed $default = null
)
: array
Get the model's original attribute values.
Property | Type | Description |
---|---|---|
$key | string | null |
string | null
|
$default | mixed |
mixed
|
inherited public getSettingsAttribute () : array
The settings is attribute contains everything that should be saved to the settings area.
inherited public getThemeAttribute () : Cms\Classes\Theme
inherited public getTwigCacheKey () : string
Returns the key used by the Twig cache.
inherited public getTwigContent () : string
Returns the Twig content string
inherited
public
getTwigNodeTree (boolean $markup = false
)
: Twig\Node\ModuleNode
Returns Twig node tree generated from the object's markup.
This method is used by the system internally and shouldn't participate in the front-end request processing.
Property | Type | Description |
---|---|---|
$markup | boolean |
boolean
Specifies the markup content. Use FALSE to load the content from the markup section. |
A node tree
inherited public getViewBag () : Cms\Components\ViewBag
Returns the configured view bag component.
This method is used only in the back-end and for internal system needs when the standard way to access components is not an option.
Returns the view bag component instance.
inherited public getWrapCode () : bool
Returns true if the code section will be wrapped in PHP tags.
inherited public hasComponent (string $componentName) : mixed
Checks if the object has a component with the specified name.
Property | Type | Description |
---|---|---|
$componentName | string |
string
Specifies the component name. |
Return false or the full component name used on the page (it could include the alias).
inherited public hasGetMutator (string $key) : bool
Determine if a get mutator exists for an attribute.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited public hasSetMutator (string $key) : bool
Determine if a set mutator exists for an attribute.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited
public
static
hydrate (array $items, string | null $datasource = null
)
: Winter\Storm\Halcyon\Collection
Create a collection of models from plain arrays.
Property | Type | Description |
---|---|---|
$items | array |
array
|
$datasource | string | null |
string | null
|
inherited public static inTheme (Cms\Classes\Theme $theme) : $this
Prepares the theme datasource for the model.
Property | Type | Description |
---|---|---|
$theme | Cms\Classes\Theme |
Specifies a parent theme. |
inherited public static initCacheItem (mixed $item)
Initializes the object properties from the cached data. The extra data set here becomes available as attributes set on the model after fetch.
Property | Type | Description |
---|---|---|
$item | mixed |
mixed
|
inherited public isAttributeRequired (string $attribute) : bool
Determines if an attribute is required based on the validation rules.
Property | Type | Description |
---|---|---|
$attribute | string |
string
|
inherited public isClassExtendedWith (string $name) : bool
Check if extendable class is extended with a behavior object
Property | Type | Description |
---|---|---|
$name | string |
string
Fully qualified behavior name |
inherited public isCompoundObject () : bool
Returns true if this template supports code and settings sections.
inherited
public
isDirty (array | string | null $attributes = null
)
: bool
Determine if the model or given attribute(s) have been modified.
Property | Type | Description |
---|---|---|
$attributes | array | string | null |
array | string | null
|
inherited public isFillable (string $key) : bool
Determine if the given attribute may be mass assigned.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited public isLoadedFromCache () : bool
Returns true if the object was loaded from the cache.
inherited public jsonSerialize () : array
Convert the object into something JSON serializable.
inherited
public
static
listInTheme (Cms\Classes\Theme $theme, boolean $skipCache = false
)
: CmsObjectCollection
Returns the list of objects in the specified theme.
This method is used internally by the system.
Property | Type | Description |
---|---|---|
$theme | Cms\Classes\Theme |
Specifies a parent theme. |
$skipCache | boolean |
boolean
Indicates if objects should be reloaded from the disk bypassing the cache. |
Returns a collection of CMS objects.
inherited public static load (mixed $theme, string $fileName) : mixed
Loads the object from a file.
This method is used in the CMS back-end. It doesn't use any caching.
Property | Type | Description |
---|---|---|
$theme | mixed |
mixed
Specifies the theme the object belongs to. |
$fileName | string |
string
Specifies the file name, with the extension. The file name can contain only alphanumeric symbols, dashes and dots. |
Returns a CMS object instance or null if the object wasn't found.
inherited public static loadCached (Cms\Classes\Theme $theme, string $fileName) : mixed
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.
Property | Type | Description |
---|---|---|
$theme | Cms\Classes\Theme |
Specifies the theme the object belongs to. |
$fileName | string |
string
Specifies the file name, with the extension. |
Returns a CMS object instance or null if the object wasn't found.
inherited public methodExists (string $name) : bool
Checks if a method exists, extension equivalent of method_exists()
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited
public
newCollection (array $models = []
)
: Winter\Storm\Halcyon\Collection
Create a new Collection instance.
Property | Type | Description |
---|---|---|
$models | array |
array
|
inherited
public
newFromBuilder (array $attributes = []
, string | null $datasource = null
)
: static
Create a new model instance that is existing.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
$datasource | string | null |
string | null
|
inherited
public
newInstance (array $attributes = []
, boolean $exists = false
)
: static
Create a new instance of the given model.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
$exists | boolean |
boolean
|
inherited public newQuery () : Winter\Storm\Halcyon\Builder
inherited public offsetExists (mixed $offset) : bool
Determine if the given attribute exists.
Property | Type | Description |
---|---|---|
$offset | mixed |
mixed
|
inherited public offsetGet (mixed $offset) : mixed
Get the value for a given offset.
Property | Type | Description |
---|---|---|
$offset | mixed |
mixed
|
inherited public offsetSet (mixed $offset, mixed $value) : void
Set the value for a given offset.
Property | Type | Description |
---|---|---|
$offset | mixed |
mixed
|
$value | mixed |
mixed
|
inherited public offsetUnset (mixed $offset) : void
Unset the value for a given offset.
Property | Type | Description |
---|---|---|
$offset | mixed |
mixed
|
inherited
public
static
on (string | null $datasource = null
)
: Winter\Storm\Halcyon\Model
Begin querying the model on a given datasource.
Property | Type | Description |
---|---|---|
$datasource | string | null |
string | null
|
inherited public propertyExists (string $name) : bool
Checks if a property exists, extension equivalent of property_exists()
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited public static query () : Winter\Storm\Halcyon\Builder
inherited public removeObservableEvents (array | mixed $observables) : void
Remove an observable event name.
Property | Type | Description |
---|---|---|
$observables | array | mixed |
array | mixed
|
inherited
public
static
resolveDatasource (string | null $datasource = null
)
: Winter\Storm\Halcyon\Datasource\DatasourceInterface
Resolve a datasource instance.
Property | Type | Description |
---|---|---|
$datasource | string | null |
string | null
|
inherited public runComponents () : void
Runs components defined in the settings Process halts if a component returns a value
inherited
public
save (array $options = null
)
: bool
Save the object to the theme.
Property | Type | Description |
---|---|---|
$options | array |
array
|
inherited
public
saveInternal (array $options = []
)
: bool
Save the model to the database. Is used by {@link save()} and {@link forceSave()}.
Property | Type | Description |
---|---|---|
$options | array |
array
|
inherited public static saved (Closure | string $callback, integer $priority) : void
Register a saved model event with the dispatcher.
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
$priority | integer |
integer
|
inherited public static saving (Closure | string $callback, integer $priority) : void
Register a saving model event with the dispatcher.
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
$priority | integer |
integer
|
inherited public setAttribute (string $key, mixed $value) : $this
Set a given attribute on the model.
Property | Type | Description |
---|---|---|
$key | string |
string
|
$value | mixed |
mixed
|
inherited public static setCacheManager (Illuminate\Cache\CacheManager $cache) : void
Set the cache manager instance.
Property | Type | Description |
---|---|---|
$cache | Illuminate\Cache\CacheManager |
Illuminate\Cache\CacheManager
|
inherited public setDatasource (string $name) : $this
Set the datasource associated with the model.
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited public static setDatasourceResolver (Winter\Storm\Halcyon\Datasource\ResolverInterface $resolver) : void
Set the datasource resolver instance.
Property | Type | Description |
---|---|---|
$resolver | Winter\Storm\Halcyon\Datasource\ResolverInterface |
Winter\Storm\Halcyon\Datasource\ResolverInterface
|
inherited public static setEventDispatcher (Illuminate\Contracts\Events\Dispatcher $dispatcher) : void
Set the event dispatcher instance.
Property | Type | Description |
---|---|---|
$dispatcher | Illuminate\Contracts\Events\Dispatcher |
Illuminate\Contracts\Events\Dispatcher
|
inherited public setFileNameAttribute (mixed $value)
File name should always contain an extension.
Property | Type | Description |
---|---|---|
$value | mixed |
mixed
|
inherited public setLoadedFromCache ($value) : void
Returns true if the object was loaded from the cache.
Property | Type | Description |
---|---|---|
$value | mixed |
mixed
|
inherited public static setModelValidator ($validator) : void
Set the validator instance.
Property | Type | Description |
---|---|---|
$validator | mixed |
mixed
|
inherited public setObservableEvents (array $observables) : $this
Set the observable event names.
Property | Type | Description |
---|---|---|
$observables | array |
array
|
inherited
public
setRawAttributes (array $attributes, boolean $sync = false
)
: $this
Set the array of model attributes. No checking is done.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
$sync | boolean |
boolean
|
inherited public setSettingsAttribute (mixed $value)
Filling the settings should merge it with attributes.
Property | Type | Description |
---|---|---|
$value | mixed |
mixed
|
inherited public syncOriginal () : $this
Sync the original attributes with the current.
inherited public syncOriginalAttribute (string $attribute) : $this
Sync a single original attribute with its current value.
Property | Type | Description |
---|---|---|
$attribute | string |
string
|
inherited public toArray () : array
Convert the model instance to an array.
inherited public toJson (integer $options) : string
Convert the model instance to JSON.
Property | Type | Description |
---|---|---|
$options | integer |
integer
|
inherited
public
unbindEvent (string | array | object $event = null
)
: self
Destroys an event binding.
Property | Type | Description |
---|---|---|
$event | string | array | object |
string | array | object
Event to destroy |
inherited public static unsetCacheManager () : void
Unset the cache manager for models.
inherited public static unsetDatasourceResolver () : void
Unset the datasource resolver for models.
inherited public static unsetEventDispatcher () : void
Unset the event dispatcher for models.
inherited public static unsetModelValidator () : void
Unset the validator for models.
inherited
public
update (array $attributes = []
)
: bool | int
Update the model in the database.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
inherited public static updated (Closure | string $callback, integer $priority) : void
Register an updated model event with the dispatcher.
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
$priority | integer |
integer
|
inherited public static updating (Closure | string $callback, integer $priority) : void
Register an updating model event with the dispatcher.
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
$priority | integer |
integer
|
inherited
public
validate ($rules = null
, $customMessages = null
, $attributeNames = null
)
: bool
Validate the model instance
Property | Type | Description |
---|---|---|
$rules | mixed |
mixed
|
$customMessages | mixed |
mixed
|
$attributeNames | mixed |
mixed
|
inherited public static validated (Closure | string $callback) : void
Create a new native event for handling afterValidate().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
inherited public static validating (Closure | string $callback) : void
Create a new native event for handling beforeValidate().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
inherited protected static boot () : void
The "booting" method of the model.
inherited protected static bootDefaultTheme () : void
Boot all of the bootable traits on the model.
inherited protected bootIfNotBooted () : void
Check if the model needs to be booted and if so, do it.
inherited protected bootNicerEvents ()
Bind some nicer events to this model, in the format of method overrides.
inherited protected static bootTraits () : void
Boot all of the bootable traits on the model.
inherited protected checkSafeMode () : void
This method checks if safe mode is enabled by config, and the code attribute is modified and populated. If so an exception is thrown.
inherited protected emitterEventSortEvents (string $eventName) : void
Sort the listeners for a given event by priority.
Property | Type | Description |
---|---|---|
$eventName | string |
string
|
inherited
protected
extendableAddLocalExtension (Closure $callback, $outerScope = null
)
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.
Property | Type | Description |
---|---|---|
$callback | Closure |
Closure
|
$outerScope | mixed |
mixed
|
inherited protected extendableIsAccessible (mixed $class, string $propertyName) : bool
Checks if a property is accessible, property equivalent of is_callable()
Property | Type | Description |
---|---|---|
$class | mixed |
mixed
|
$propertyName | string |
string
|
inherited protected extensionCallMethod (ReflectionClass $class, string $method, array $params)
Calls a method through reflection.
Property | Type | Description |
---|---|---|
$class | ReflectionClass |
ReflectionClass
|
$method | string |
string
|
$params | array |
array
|
inherited protected extensionExtractMethods (string $extensionName, object $extensionObject) : void
Extracts the available methods from a behavior and adds it to the list of callable methods.
Property | Type | Description |
---|---|---|
$extensionName | string |
string
|
$extensionObject | object |
object
|
inherited protected extensionGetClassLoader () : Winter\Storm\Support\ClassLoader | null
Gets the class loader
inherited
protected
extensionGetParentClass ($instance = null
)
: ReflectionClass | false
Gets the parent class using reflection.
The parent class must either not be the Extendable
class, or must not be using the ExtendableTrait
trait,
in order to prevent infinite loops.
Property | Type | Description |
---|---|---|
$instance | mixed |
mixed
|
inherited protected extensionMethodExists (ReflectionClass $class, string $methodName) : bool
Determines if the given class reflection contains the given method.
Property | Type | Description |
---|---|---|
$class | ReflectionClass |
ReflectionClass
|
$methodName | string |
string
|
inherited protected extensionNormalizeClassName (string $name) : string
Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited protected fillViewBagArray () : void
Copies view bag properties to the view bag array.
This is required for the back-end editors.
inherited protected fillableFromArray (array $attributes) : array
Get the fillable attributes of a given array.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
inherited protected finishSave () : void
Finish processing on a successful save operation.
inherited
protected
fireModelEvent (string $event, boolean $halt = true
)
: mixed
Fire the given event for the model.
Property | Type | Description |
---|---|---|
$event | string |
string
|
$halt | boolean |
boolean
|
inherited protected getArrayableAppends () : array
Get all of the appendable values that are arrayable.
inherited protected getAttributeFromArray (string $key) : mixed
Get an attribute from the $attributes array.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited protected getValidationAttributes () : array
Returns the model data used for validation.
inherited protected static makeValidator ($data, $rules, $customMessages, $attributeNames) : Illuminate\Validation\Validator
Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel.
Property | Type | Description |
---|---|---|
$data | mixed |
mixed
|
$rules | mixed |
mixed
|
$customMessages | mixed |
mixed
|
$attributeNames | mixed |
mixed
|
inherited protected mutateAttribute (string $key, mixed $value) : mixed
Get the value of an attribute using its mutator.
Property | Type | Description |
---|---|---|
$key | string |
string
|
$value | mixed |
mixed
|
inherited protected mutateAttributeForArray (string $key, mixed $value) : mixed
Get the value of an attribute using its mutator for array conversion.
Property | Type | Description |
---|---|---|
$key | string |
string
|
$value | mixed |
mixed
|
inherited protected originalIsNumericallyEquivalent (string $key) : bool
Determine if the new and old values for a given key are numerically equivalent.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited protected parseComponentSettings () : void
Parse component sections.
Replace the multiple component sections with a single "components" element in the $settings property.
inherited
protected
parseEventAndPayload (mixed $event, mixed $payload = null
)
: array
Parse the given event and payload and prepare them for dispatching.
Property | Type | Description |
---|---|---|
$event | mixed |
mixed
|
$payload | mixed |
mixed
|
inherited protected parseSettings () : void
Parses the settings array.
Child classes can override this method in order to update the content of the $settings property after the object is loaded from a file.
inherited protected performDeleteOnModel () : void
Perform the actual delete query on this model instance.
inherited protected performInsert (Winter\Storm\Halcyon\Builder $query) : bool
Perform a model insert operation.
Property | Type | Description |
---|---|---|
$query | Winter\Storm\Halcyon\Builder |
Winter\Storm\Halcyon\Builder
|
inherited protected performUpdate (Winter\Storm\Halcyon\Builder $query) : bool
Perform a model update operation.
Property | Type | Description |
---|---|---|
$query | Winter\Storm\Halcyon\Builder |
Winter\Storm\Halcyon\Builder
|
inherited protected processRuleFieldNames (array $rules) : array
Processes field names in a rule array.
Converts any field names using array notation (ie. field[child]
) into dot notation (ie. field.child
)
Property | Type | Description |
---|---|---|
$rules | array |
array
Rules array |
inherited protected processValidationRules ($rules)
Process rules
Property | Type | Description |
---|---|---|
$rules | mixed |
mixed
|
inherited protected static registerModelEvent (string $event, Closure | string $callback, integer $priority) : void
Register a model event with the dispatcher.
Property | Type | Description |
---|---|---|
$event | string |
string
|
$callback | Closure | string |
Closure | string
|
$priority | integer |
integer
|
inherited protected throwHalcyonSaveException (Exception $ex)
Converts an exception type thrown by Halcyon to a native CMS exception.
Property | Type | Description |
---|---|---|
$ex | Exception |
Exception
|
inherited protected validateSettings () : void
If the model is loaded with an invalid INI section, the invalid content will be passed as a special attribute. Look for it, then locate the failure reason.