Process::setViewVars() method

Set a variable that will be passed to the output view.

You can also do this by having your execute() method(s) return an associative array of variables to send to the view file.

Usage

// basic usage
$process->setViewVars($key);

// usage with all arguments
$process->setViewVars($key, $value = null);

Arguments

NameType(s)Description
keystring, array

Property to set, or array of [property => value] to set (leaving 2nd argument as null)

value (optional)mixed, null

Value to set

Return value

$this

Object instance it was called from (method supports fluent interface).

Exceptions

Method can throw exceptions on error:

  • WireException - if given an invalid type for $key


Process methods and properties

API reference based on ProcessWire core version 3.0.236

“…building with ProcessWire was a breeze, I really love all the flexibility the system provides. I can’t imagine using any other CMS in the future.” —Thomas Aull