Updated 14 September 2026
On this page
Description
Registers the JavaScript class that shows a field type in the summary. The class extends gotrLiveSummaries.Field; getValue() returns the value (or false to leave the field out) and render() may return the markup of the line. A registered class is used before the built-in class of the same type, so you can also replace how a standard field is shown. Call it from a script that depends on gotrls-frontend-scripts. Read the full walkthrough here: Adding a custom field type
Parameters
type | String. The field type, e.g. ‘my_rating’
fieldClass | Function. The class
Usage
Enqueue this in a script of your own with gotrls-frontend-scripts as dependency.
class MyRating extends gotrLiveSummaries.Field {
getValue() {
const checked = document.querySelector( `#field_${ this.formId }_${ this.fieldId } input:checked` );
return checked ? checked.value : false;
}
}
gotrLiveSummaries.registerFieldType( 'my_rating', MyRating );
Since
version 2.2.0
Didn’t find what you were looking for?
Or contact support and I will help you out.
