Wire class - ProcessWire API

Wire derived classes have a $this->wire() method that provides access to ProcessWire’s API variables. API variables can also be accessed as local properties in most cases. Wire also provides basic methods for tracking changes and managing runtime notices specific to the instance.

Wire derived classes can specify which methods are “hookable” by precending the method name with 3 underscores like this: ___myMethod(). Other classes can then hook either before or after that method, modifying arguments or return values. Several other hook methods are also provided for Wire derived classes that are hooking into others.


Click any linked item for full usage details and examples. Hookable methods are indicated with the icon.

Common

NameReturnSummary 

Wire::wire()

mixed

Get an API variable, create an API variable, or inject dependencies.

 

Notices

NameReturnSummary 

Wire::error($text)

$this

Record an non-fatal error message in the system-wide notices.

 

Wire::errors()

Notices array string

Return or manage errors recorded by just this object or all Wire objects

 

Wire::log()

WireLog

Log a message for this class

Wire::message($text)

$this

Record an informational or “success” message in the system-wide notices.

 

Wire::messages()

Notices array string

Return or manage messages recorded by just this object or all Wire objects

 

Wire::warning($text)

$this

Record a warning error message in the system-wide notices.

 

Wire::warnings()

Notices array string

Return or manage warnings recorded by just this object or all Wire objects

 

Changes

Methods to support tracking and retrieval of changes made to the object.

NameReturnSummary 

Wire::getChanges()

array

Return an array of properties that have changed while change tracking was on.

 

Wire::isChanged()

bool

Does the object have changes, or has the given property changed?

 

Wire::resetTrackChanges()

$this

Clears out any tracked changes and turns change tracking ON or OFF

 

Wire::setTrackChanges()

$this

Turn change tracking ON or OFF

 

Wire::trackChange(string $what)

$this

Track a change to a property in this object

 

Wire::trackChanges()

int

Returns true or 1 if change tracking is on, or false or 0 if it is not, or mode bitmask (int) if requested.

 
Wire::trackChangesOn const2For setTrackChanges() method flags: track names only (default). 
Wire::trackChangesValues const4For setTrackChanges() method flags: track names and values. 

Wire::untrackChange(string $what)

$this

Untrack a change to a property in this object

 

API reference based on ProcessWire core version 3.0.255