Fully Qualified Name: | Zend\View\Helper\DeclareVars |
Extends: | AbstractHelper |
Helper for declaring default values of template variables
Name | Description | Defined By |
---|---|---|
__invoke() | Declare template vars to set default values and avoid notices when using strictVars | DeclareVars |
getView() | Get the view object | AbstractHelper |
setView() | Set the View object | AbstractHelper |
Declare template vars to set default values and avoid notices when using strictVars
Primarily for use when using {@link Zend\View\Variables::setStrictVars()}, this helper can be used to declare template variables that may or may not already be set in the view object, as well as to set default values. Arrays passed as arguments to the method will be used to set default values; otherwise, if the variable does not exist, it is set to an empty string.
Usage:
$this->declareVars(
'varName1',
'varName2',
array('varName3' => 'defaultValue',
'varName4' => array()
)
);
Parameter Name | Type | Description |
---|---|---|
$ | string|array | variable |
Returns: void
Get the view object
Returns: null|\Renderer
Set the View object
Parameter Name | Type | Description |
---|---|---|
$view | \Renderer |
Returns: \AbstractHelper