Constructor
new HandlebarsHelpers()
Methods
(static) checked() → {string}
For checkboxes, if the value of the checkbox is true, add the "checked" property, otherwise add nothing.
Returns:
- Type
- string
(static) colorPicker(options) → {Handlebars.SafeString}
Render a pair of inputs for selecting a color.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | Helper options Properties
|
Returns:
- Type
- Handlebars.SafeString
(static) editor(options) → {Handlebars.SafeString}
Construct an editor element for rich text editing with TinyMCE
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | Helper options Properties
|
Returns:
- Type
- Handlebars.SafeString
(static) filePicker(options) → {Handlebars.SafeString|string}
Render a file-picker button linked to an <input> field
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | Helper options Properties
|
Returns:
- Type
- Handlebars.SafeString | string
(static) localize() → {string}
Translate a provided string key by using the loaded dictionary of localization strings.
Example
Translate a provided localization string, optionally including formatting parameters
<label>{{localize "ACTOR.Create"}}</label> <!-- "Create Actor" -->
<label>{{localize "CHAT.InvalidCommand", command=foo}}</label> <!-- "foo is not a valid chat message command." -->
Returns:
- Type
- string
(static) numberFormat() → {string}
A string formatting helper to display a number with a certain fixed number of decimals and an explicit sign.
Returns:
- Type
- string
(static) numberInput() → {Handlebars.SafeString}
Render a form input field of type number with value appropriately rounded to step size.
Returns:
- Type
- Handlebars.SafeString
(static) radioBoxes(name, choices, options) → {Handlebars.SafeString}
A helper to create a set of radio checkbox input elements in a named set. The provided keys are the possible radio values while the provided values are human readable labels.
Examples
The provided input data
let groupName = "importantChoice";
let choices = {a: "Choice A", b: "Choice B"};
let chosen = "a";
The template HTML structure
<div class="form-group">
<label>Radio Group Label</label>
<div class="form-fields">
{{radioBoxes groupName choices checked=chosen localize=true}}
</div>
</div>
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
name |
string | The radio checkbox field name |
|||||||||
choices |
object | A mapping of radio checkbox values to human readable labels |
|||||||||
options |
object | Options which customize the radio boxes creation Properties
|
Returns:
- Type
- Handlebars.SafeString
(static) rangePicker(options) → {Handlebars.SafeString}
Render a pair of inputs for selecting a color.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | Helper options Properties
|
Returns:
- Type
- Handlebars.SafeString
(static) select() → {Handlebars.SafeString}
A helper to assign an <option> within a <select> block as selected based on its value Escape the string as handlebars would, then escape any regexp characters in it
Returns:
- Type
- Handlebars.SafeString
(static) selectOptions(choices, options) → {Handlebars.SafeString}
A helper to create a set of <option> elements in a <select> block based on a provided dictionary. The provided keys are the option values while the provided values are human readable labels. This helper supports both single-select as well as multi-select input fields.
Examples
The provided input data
let choices = {a: "Choice A", b: "Choice B"};
let value = "a";
The template HTML structure
<select name="importantChoice">
{{selectOptions choices selected=value localize=true}}
</select>
The resulting HTML
<select name="importantChoice">
<option value="a" selected>Choice A</option>
<option value="b">Choice B</option>
</select>
Using inverted
let choices = {"Choice A": "a", "Choice B": "b"};
let value = "a";
The template HTML structure
<select name="importantChoice">
{{selectOptions choices selected=value inverted=true}}
</select>
Using nameAttr and labelAttr with objects
let choices = {foo: {key: "a", label: "Choice A"}, bar: {key: "b", label: "Choice B"}};
let value = "b";
The template HTML structure
<select name="importantChoice">
{{selectOptions choices selected=value nameAttr="key" labelAttr="label"}}
</select>
Using nameAttr and labelAttr with arrays
let choices = [{key: "a", label: "Choice A"}, {key: "b", label: "Choice B"}];
let value = "b";
The template HTML structure
<select name="importantChoice">
{{selectOptions choices selected=value nameAttr="key" labelAttr="label"}}
</select>
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
choices |
object | A mapping of radio checkbox values to human readable labels |
|||||||||||||||||||||||||||||||||||
options |
object | Helper options Properties
|
Returns:
- Type
- Handlebars.SafeString