trait interacts_with_forms

internal  
 

Trait handling Moodle Form interactions within controllers.

Properties

protected object|string|null $form
protected mixed $formparams

Methods

void
set_form(object|string $form, mixed $formparams = null)

Set the form for the controller to handle.

bool
handle_form_submission()

Check if the bound form was submitted and validated.

mixed
process_form_submission()

Return submitted form data when valid, otherwise false.

bool
process_form_cancel()

Determine if the form has been cancelled.

bool
is_form_submitted()

Check if the form was submitted (regardless of validation).

string
render_form_html()

Internal helper to render the form and return HTML.

Details

at line 43
void set_form(object|string $form, mixed $formparams = null)

Set the form for the controller to handle.

Parameters

object|string $form

Class string or instance

mixed $formparams

Parameters for the form constructor

Return Value

void

Exceptions

coding_exception
moodle_exception

at line 65
protected bool handle_form_submission()

Check if the bound form was submitted and validated.

Return Value

bool

at line 73
protected mixed process_form_submission()

Return submitted form data when valid, otherwise false.

Return Value

mixed

at line 85
protected bool process_form_cancel()

Determine if the form has been cancelled.

Return Value

bool

at line 97
protected bool is_form_submitted()

Check if the form was submitted (regardless of validation).

Return Value

bool

at line 105
protected string render_form_html()

Internal helper to render the form and return HTML.

Return Value

string