\sa\application\IViewModel
interface.__construct(array $data)
$data
parameter will contain any data initially passed from the parent view.getXssSanitationExcludes()
defaultOptions
and heading
may be accessed in the subview as so,A view model's public properties are generally reserved for constants or default values. It is not recommended to populate these values by performing business logic in the constructor. For business logic, use the view model's helper methods instead.
getXssSanitzationExcludes()
method. Any public properties will be excluded from XSS sanitizing step.getXssSanitizationExcludes()
method!.getShippingOptions
method is exposed as a helper method. This is where complex business operations are performed, such as fetching data from a repository or constructing data structures.To encourage this practice, it is not possible to directly bind a view model to a parent view.
$view
$viewModel
$data
$viewmodel
variable becomes available in the subview's context. This variable holds the view model's instance. It is used to access helper methods within the view model.