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) concat(…values) → {Handlebars.SafeString}
Concatenate a number of string terms into a single string. This is useful for passing arguments with variable names.
Example
{{filePicker target=(concat "faces." i ".img") type="image"}}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
values |
Array.<string> |
<repeatable> |
The values to concatenate |
Returns:
- Type
- Handlebars.SafeString
(static) disabled() → {string}
For use in form inputs. If the supplied value is truthy, add the "disabled" property, otherwise add nothing.
Returns:
- Type
- string
(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 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
<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(value, options) → {Handlebars.SafeString}
A string formatting helper to display a number with a certain fixed number of decimals and an explicit sign.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
value |
number | A numeric value to format |
|||||||||||||||
options |
object | Additional options which customize the resulting format Properties
|
Returns:
The formatted string to be included in a template
- Type
- Handlebars.SafeString
(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
let groupName = "importantChoice";
let choices = {a: "Choice A", b: "Choice B"};
let chosen = "a";
<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 value in a range.
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
let choices = {a: "Choice A", b: "Choice B"};
let value = "a";
<select name="importantChoice">
{{selectOptions choices selected=value localize=true}}
</select>
<select name="importantChoice">
<option value="a" selected>Choice A</option>
<option value="b">Choice B</option>
</select>
let choices = {"Choice A": "a", "Choice B": "b"};
let value = "a";
<select name="importantChoice">
{{selectOptions choices selected=value inverted=true}}
</select>
let choices = {foo: {key: "a", label: "Choice A"}, bar: {key: "b", label: "Choice B"}};
let value = "b";
<select name="importantChoice">
{{selectOptions choices selected=value nameAttr="key" labelAttr="label"}}
</select>
let choices = [{key: "a", label: "Choice A"}, {key: "b", label: "Choice B"}];
let value = "b";
<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