widget_interface
interface widget_interface
Contract for UI widgets.
Widgets prepare data for a frontend component (Mustache or Vue) and expose rendering helpers used by controllers and blocks.
Methods
void
set_id(string $id)
Set the unique identifier for this widget instance.
string
get_id()
Get the unique identifier.
array
get_data()
Prepare and return the data structure required by the template/component.
string
render()
Render the widget's HTML output.
Details
at line 32
void
set_id(string $id)
Set the unique identifier for this widget instance.
Needed for DOM ID generation and Vue mounting points.
at line 37
string
get_id()
Get the unique identifier.
at line 44
array
get_data()
Prepare and return the data structure required by the template/component.
at line 52
string
render()
Render the widget's HTML output.
Usually delegates to $OUTPUT->render_from_template().