Property | Type | Description | |
---|---|---|---|
$allLocalHooks | Cache of all local hooks combined, for debugging purposes |
Property | Type | Description | |
---|---|---|---|
$_notices | ***************************************************************************************************** NOTICES AND LOGS | ||
$defaultHookOptions | - type: may be either 'method' or 'property'. If property, then it will respond to $obj->property rather than $obj->method(). - before: execute the hook before the method call? Not applicable if 'type' is 'property'. - after: execute the hook after the method call? (allows modification of return value). Not applicable if 'type' is 'property'. - priority: a number determining the priority of a hook, where lower numbers are executed before higher numbers. - allInstances: attach the hook to all instances of this object? (store in staticHooks rather than localHooks). Set automatically, but you may still use in some instances. - fromClass: the name of the class containing the hooked method, if not the object where addHook was executed. Set automatically, but you may still use in some instances. - argMatch: array of Selectors objects where the indexed argument (n) to the hooked method must match, order to execute hook. - objMatch: Selectors object that the current object must match in order to execute hook | ||
$fuel | Fuel | null | Fuel holds references to other ProcessWire system objects. It is an instance of the Fuel class. | |
$hookMethodCache | Hooked methods end with '()' while hooked properties don't. This does not distinguish which instance it was added to or whether it was removed. But will use keys in the form 'fromClass::method' (with value 'method') in cases where a fromClass was specified. This cache exists primarily to gain some speed in our __get and __call methods. | ||
$localHooks | Hooks that are local to this instance of the class only. | ||
$staticHooks | This array holds references to those static hooks, and is shared among all classes descending from Wire. It is for internal use only. See also self::$defaultHookOptions[allInstances]. | ||
$useFuel | boolean | Whether this class may use fuel variables in local scope, like $this->item |
Method | Description | |
---|---|---|
_ ( string $text ) : string | Translate the given text string into the current language if available. | |
___changed ( string $what, mixed $old = null, mixed $new = null ) | Hookable method that is called whenever a property has changed while self::$trackChanges is true | |
___log ( string $str = '', array $options = [] ) : WireLog | null | Log a message for this class | |
___trackException ( Exception $e, boolean | integer $severe = true, string | array | object | true $text = null ) | Hookable method called when an Exception occurs | |
__call ( string $method, array $arguments ) : mixed | Provides the gateway for calling hooks in ProcessWire | |
__construct ( ) | ||
__debugInfo ( ) : array | debugInfo PHP 5.6+ magic method | |
__get ( string $name ) : mixed | null | Get an object property by direct reference or NULL if it doesn't exist | |
__toString ( ) | Unless overridden, classes descending from Wire return their class name when typecast as a string | |
_n ( string $textSingular, string $textPlural, integer $count ) : string | Perform a language translation with singular and plural versions | |
_x ( string $text, string $context ) : string | Perform a language translation in a specific context | |
addHook ( string $method, object | null | callable $toObject, string $toMethod = null, array $options = [] ) : string | Hook a function/method to a hookable method call in this object | |
addHookAfter ( string $method, object | null | callable $toObject, string $toMethod = null, array $options = [] ) : string | Shortcut to the addHook() method which adds a hook to be executed after the hooked method. | |
addHookBefore ( string $method, object | null | callable $toObject, string $toMethod = null, array $options = [] ) : string | Shortcut to the addHook() method which adds a hook to be executed before the hooked method. | |
addHookProperty ( string $property, object | null | callable $toObject, string $toMethod = null, array $options = [] ) : string | Shortcut to the addHook() method which adds a hook to be executed as an object property. | |
className ( array | null $options = null ) : string | Return this object's class name | |
error ( string | array | Wire $text, integer | boolean $flags ) | Record an non-fatal error message in the system-wide notices. | |
errors ( string | array $options = [] ) : Notices | string | Return errors recorded by this object | |
fuel ( string $name ) : mixed | null | Get the Fuel specified by $name or NULL if it doesn't exist | |
getAllFuel ( ) : Fuel | Returns an iterable Fuel object of all Fuel currently loaded | |
getChanges ( boolean $getValues = false ) : array | Return an array of properties that have changed while change tracking was on. | |
getFuel ( string $name = '' ) : mixed | null | Get the Fuel specified by $name or NULL if it doesn't exist | |
getHooks ( string $method = '', integer $type ) : array | Return all hooks associated with this class instance or method (if specified) | |
hasHook ( string $method ) : boolean | Similar to isHooked(), returns true if the method or property hooked, false if it isn't. | |
isChanged ( string $what = '' ) : boolean | Has the given property changed? | |
isHooked ( string $method, Wire $instance = null ) : boolean | Returns true if the method/property hooked, false if it isn't. | |
message ( string | array | Wire $text, integer | boolean $flags ) | Record an informational or 'success' message in the system-wide notices. | |
messages ( string | array $options = [] ) : Notices | string | Return messages recorded by this object | |
removeHook ( string | null $hookId ) | Given a Hook ID provided by addHook() this removes the hook | |
resetTrackChanges ( boolean $trackChanges = true ) | Clears out any tracked changes and turns change tracking ON or OFF | |
runHooks ( string $method, array $arguments, string $type = 'method' ) : array | Provides the implementation for calling hooks in ProcessWire | |
setFuel ( string $name, mixed $value, boolean $lock = false ) | Add fuel to all classes descending from Wire | |
setTrackChanges ( boolean | integer $trackChanges = true ) | Turn change tracking ON or OFF | |
trackChange ( string $what, mixed $old = null, mixed $new = null ) | Track a change to a property in this object | |
trackChanges ( boolean $getMode = false ) : boolean | integer | Returns true if change tracking is on, or false if it's not. | |
untrackChange ( string $what ) | Untrack a change to a property in this object | |
useFuel ( boolean $useFuel = null ) : boolean | Should fuel vars be scoped locally to this class instance? | |
warning ( string | array | Wire $text, integer | boolean $flags ) | Record a warning error message in the system-wide notices. | |
warnings ( string | array $options = [] ) : Notices | string | Return warnings recorded by this object | |
wire ( string | object $name = '', null | mixed $value = null, boolean $lock = false ) : ProcessWire | Wire | Session | Page | Pages | Modules | User | Users | Roles | Permissions | Templates | Fields | Fieldtypes | Sanitizer | Config | Notices | WireDatabasePDO | WireInput | string | mixed | Get or inject a ProcessWire API variable |
Method | Description | |
---|---|---|
___callUnknown ( string $method, array $arguments ) : null | mixed | If the above __call() resulted in no handler, this method is called. | |
_notice ( $text, integer $flags, string $name, string $class ) | Record a Notice, internal use (contains the code for message, warning and error methods) |
public ___log ( string $str = '', array $options = [] ) : WireLog | null | ||
$str | string | Text to log, or omit to just return the name of the log |
$options | array | Optional extras to include: - url (string): URL to record the with the log entry (default=auto-detect) - name (string): Name of log to use (default=auto-detect) |
return | WireLog | null |
public ___trackException ( Exception $e, boolean | integer $severe = true, string | array | object | true $text = null ) | ||
$e | Exception | Exception object that was thrown |
$severe | boolean | integer | Whether or not it should be considered severe (default=true) |
$text | string | array | object | true | Additional details (optional). When provided, it will be sent to $this->error($text) if $severe==true, or $this->warning($text) if $severe==false. Specify boolean true to just sent the $e->getMessage() to $this->error() or $this->warning(). |
public __debugInfo ( ) : array | ||
return | array |
public __toString ( ) |
public _n ( string $textSingular, string $textPlural, integer $count ) : string | ||
$textSingular | string | Singular version of text (when there is 1 item) |
$textPlural | string | Plural version of text (when there are multiple items or 0 items) |
$count | integer | Quantity used to determine whether singular or plural. |
return | string | Translated text or original text if translation not available. |
public addHook ( string $method, object | null | callable $toObject, string $toMethod = null, array $options = [] ) : string | ||
$method | string | Method name to hook into, NOT including the three preceding underscores. May also be Class::Method for same result as using the fromClass option. |
$toObject | object | null | callable | Object to call $toMethod from, Or null if $toMethod is a function outside of an object, Or function|callable if $toObject is not applicable or function is provided as a closure. |
$toMethod | string | Method from $toObject, or function name to call on a hook event. Optional. |
$options | array | See self::$defaultHookOptions at the beginning of this class. Optional. |
return | string | A special Hook ID that should be retained if you need to remove the hook later |
public addHookAfter ( string $method, object | null | callable $toObject, string $toMethod = null, array $options = [] ) : string | ||
$method | string | Method name to hook into, NOT including the three preceding underscores May also be Class::Method for same result as using the fromClass option. |
$toObject | object | null | callable | Object to call $toMethod from, Or null if $toMethod is a function outside of an object, Or function|callable if $toObject is not applicable or function is provided as a closure. |
$toMethod | string | Method from $toObject, or function name to call on a hook event. Optional. |
$options | array | See self::$defaultHookOptions at the beginning of this class. Optional. |
return | string | A special Hook ID that should be retained if you need to remove the hook later |
public addHookBefore ( string $method, object | null | callable $toObject, string $toMethod = null, array $options = [] ) : string | ||
$method | string | Method name to hook into, NOT including the three preceding underscores May also be Class::Method for same result as using the fromClass option. |
$toObject | object | null | callable | Object to call $toMethod from, Or null if $toMethod is a function outside of an object, Or function|callable if $toObject is not applicable or function is provided as a closure. |
$toMethod | string | Method from $toObject, or function name to call on a hook event. Optional. |
$options | array | See self::$defaultHookOptions at the beginning of this class. Optional. |
return | string | A special Hook ID that should be retained if you need to remove the hook later |
public addHookProperty ( string $property, object | null | callable $toObject, string $toMethod = null, array $options = [] ) : string | ||
$property | string | Method name to hook into, NOT including the three preceding underscores May also be Class::Method for same result as using the fromClass option. |
$toObject | object | null | callable | Object to call $toMethod from, Or null if $toMethod is a function outside of an object, Or function|callable if $toObject is not applicable or function is provided as a closure. |
$toMethod | string | Method from $toObject, or function name to call on a hook event. Optional. |
$options | array | See self::$defaultHookOptions at the beginning of this class. Optional. |
return | string | A special Hook ID that should be retained if you need to remove the hook later |
public errors ( string | array $options = [] ) : Notices | string | ||
$options | string | array | One or more of array elements or space separated string of: first: only first item will be returned (string) last: only last item will be returned (string) all: include all errors, including those beyond the scope of this object clear: clear out all items that are returned from this method array: return an array of strings rather than series of Notice objects. string: return a newline separated string rather than array/Notice objects. |
return | Notices | string | Array of NoticeError error messages or string if last, first or str option was specified. |
public static getAllFuel ( ) : Fuel | ||
return | Fuel |
public getChanges ( boolean $getValues = false ) : array | ||
$getValues | boolean | If true, then an associative array will be returned containing an array of previous values, oldest to newest. |
return | array |
public static isHooked ( string $method, Wire $instance = null ) : boolean | ||
$method | string | Method or property name in one of the following formats: Class::method() Class::property method() property |
$instance | Wire | Optional instance to check against (see hasHook method for details) Note that if specifying an $instance, you may not use the Class::method() or Class::property options for $method argument. |
return | boolean |
public messages ( string | array $options = [] ) : Notices | string | ||
$options | string | array | One or more of array elements or space separated string of: first: only first item will be returned (string) last: only last item will be returned (string) all: include all items of type (messages or errors) beyond the scope of this object clear: clear out all items that are returned from this method errors: returns errors rather than messages. warnings: returns warnings rather than messages. array: return an array of strings rather than series of Notice objects. string: return a newline separated string rather than array/Notice objects. |
return | Notices | string | Array of NoticeError error messages or string if last, first or str option was specified. |
public removeHook ( string | null $hookId ) | ||
$hookId | string | null |
public resetTrackChanges ( boolean $trackChanges = true ) | ||
$trackChanges | boolean | True to turn change tracking ON, or false to turn OFF. Default of true is assumed. |
public runHooks ( string $method, array $arguments, string $type = 'method' ) : array | ||
$method | string | Method or property to run hooks for. |
$arguments | array | Arguments passed to the method and hook. |
$type | string | May be either 'method' or 'property', depending on the type of call. Default is 'method'. |
return | array | Returns an array with the following information: [return] => The value returned from the hook or NULL if no value returned or hook didn't exist. [numHooksRun] => The number of hooks that were actually run. [methodExists] => Did the hook method exist as a real method in the class? (i.e. with 3 underscores ___method). [replace] => Set by the hook at runtime if it wants to prevent execution of the original hooked method. |
public setTrackChanges ( boolean | integer $trackChanges = true ) | ||
$trackChanges | boolean | integer | True to turn on, false to turn off. Integer to specify bitmask. |
public untrackChange ( string $what ) | ||
$what | string | Name of property that you want to remove it's change being tracked |
public warnings ( string | array $options = [] ) : Notices | string | ||
$options | string | array | One or more of array elements or space separated string of: first: only first item will be returned (string) last: only last item will be returned (string) all: include all warnings, including those beyond the scope of this object clear: clear out all items that are returned from this method array: return an array of strings rather than series of Notice objects. string: return a newline separated string rather than array/Notice objects. |
return | Notices | string | Array of NoticeError error messages or string if last, first or str option was specified. |
public wire ( string | object $name = '', null | mixed $value = null, boolean $lock = false ) : ProcessWire | Wire | Session | Page | Pages | Modules | User | Users | Roles | Permissions | Templates | Fields | Fieldtypes | Sanitizer | Config | Notices | WireDatabasePDO | WireInput | string | mixed | ||
$name | string | object | Name of API variable to retrieve, set, or omit to retrieve the master ProcessWire object |
$value | null | mixed | Value to set if using this as a setter, otherwise omit. |
$lock | boolean | When using as a setter, specify true if you want to lock the value from future changes (default=false) |
return | ProcessWire | Wire | Session | Page | Pages | Modules | User | Users | Roles | Permissions | Templates | Fields | Fieldtypes | Sanitizer | Config | Notices | WireDatabasePDO | WireInput | string | mixed |
protected $_notices |
public static $allLocalHooks |
protected static $defaultHookOptions |
protected static Fuel|null $fuel | ||
return | Fuel | null |
protected static $hookMethodCache |
protected $localHooks |
protected static $staticHooks |
protected bool $useFuel | ||
return | boolean |