Developer Documentation

This class adds extra methods to form wrapper specific to be used for module add / update forms mod/{modname}/mod_form.php replaced deprecated mod/{modname}/mod.html

File Size: 802 lines (36 kb)
Included or required:0 times
Referenced: 15 times
Includes or requires: 0 files

Defines 15 functions

Functions that are not part of a class:

moodleform_mod($current, $section, $cm, $course)   X-Ref

init_features()   X-Ref
No description

data_preprocessing(&$default_values)   X-Ref
Only available on moodleform_mod.

param: array $default_values passed by reference

definition_after_data()   X-Ref
Each module which defines definition_after_data() must call this method using parent::definition_after_data();

validation($data, $files)   X-Ref
No description

set_data($default_values)   X-Ref
Load in existing data as form defaults. Usually new entry defaults are stored directly in
form definition (new entry form); this function is used to load in data where values
already exist and data is being edited (edit entry form).

param: mixed $default_values object or array of default values

standard_coursemodule_elements()   X-Ref
Adds all the standard elements to a form to edit the settings for an activity module.

add_completion_rules()   X-Ref
Can be overridden to add custom completion rules if the module wishes
them. If overriding this, you should also override completion_rule_enabled.
Just add elements to the form as needed and return the list of IDs. The
system will call disabledIf and handle other behaviour for each returned

return: array Array of string IDs of added items, empty array if none

completion_rule_enabled($data)   X-Ref
Called during validation. Override to indicate, based on the data, whether
a custom completion rule is enabled (selected).

param: array $data Input data (not yet validated)
return: bool True if one or more rules is enabled, false if none are;

standard_hidden_coursemodule_elements()   X-Ref
No description

standard_grading_coursemodule_elements()   X-Ref
No description

add_intro_editor($required=false, $customlabel=null)   X-Ref
No description

add_action_buttons($cancel=true, $submitlabel=null, $submit2label=null)   X-Ref
Overriding formslib's add_action_buttons() method, to add an extra submit "save changes and return" button.

param: bool $cancel show cancel button
param: string $submitlabel null means default, false means none, string is label text
param: string $submit2label  null means default, false means none, string is label text
return: void

apply_admin_locked_flags()   X-Ref
Get the list of admin settings for this module and apply any locked settings.
This cannot happen in apply_admin_defaults because we do not the current values of the settings
in that function because set_data has not been called yet.

return: void

apply_admin_defaults($datetimeoffsets = array()   X-Ref
Get the list of admin settings for this module and apply any defaults/advanced/locked settings.

param: $datetimeoffsets array - If passed, this is an array of fieldnames => times that the
return: void

Search This Site: