Using a ViewHelper with a Mustache widget - tooltwist/documentation GitHub Wiki
Using a ViewHelper
If your tempate requires any variables - whether it be related to data access, parameters from the widget, or the result of some sort of screen logic - then you will need to create a view helper class. This is created in exactly the same manner as any other class that extends tooltwist.wbd.ViewHelper (or tooltwist.wbd.ProductionHelper).
The view helper passes values to the template via standard getter functions. For example, if the template is:
My name is {{name}}.
and the ViewHelper has this method:
public String getName() {
return "Fred";
}
then the resulting code would be
My name is Fred.
Pretty simple. The view helper functions may also return Hash and List objects. Details and examples can be found here. As a rule of thumb though, try to keep the object types simple.