Base view model for use with Mustache.
The main purpose of this class is to provide the view model with the App
instance, thus giving it access to the various helper methods available in
that class. Additionally, it provides an instance of Escaper, allowing you
to do context-specific escaping within helpers you define in the view model.
category |
Phlyty |
package |
Phlyty |
subpackage |
View |
Methods
Constructor
__construct(\Phlyty\App $app, null|\Zend\Escaper\Escaper $escaper = null
)
Receive and set the App instance as a protected property.
If an Escaper instance is passed, it will be assigned;
otherwise, an Escaper instance will be instantiated and
assigned.
Parameters
Bind a helper within the view model object's context
bindHelper(string $name, callable $helper) : \Phlyty\View\MustacheViewModel
Allows using '$this' within the helper in order to access public
properties and methods. Binds the helper to the public property
given by $name.
Parameters
$name
string
$helper
callable
Returns
Properties