Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250706) (a6b17d8f6bd)
|
Public Member Functions | |
backup_define_structure (backup_nested_element $customfieldelement) | |
Callback for backup, allowing custom fields to add additional data to the backup. | |
datafield () | |
Return the name of the field where the information is stored. | |
delete () | |
Delete data. | |
display () | |
Used by handlers to display data on various places. | |
export_value () | |
Returns value in a human-readable format. | |
get ($property) | |
Persistent getter parser. | |
get_context () | |
Return the context of the field. | |
get_default_value () | |
Returns the default value in non human-readable format. | |
get_field () | |
Field associated with this data. | |
get_form_element_name () | |
Returns the name of the field to be used on HTML forms. | |
get_value () | |
Returns the value as it is stored in the database or default value if data record is not present. | |
instance_form_before_set_data (\stdClass $instance) | |
Prepares the custom field data related to the object to pass to mform->set_data() and adds them to it. | |
instance_form_definition (\MoodleQuickForm $mform) | |
Add a field to the instance edit form. | |
instance_form_definition (MoodleQuickForm $mform) | |
Add form elements for editing the custom field instance. | |
instance_form_definition_after_data (\MoodleQuickForm $mform) | |
Called from instance edit form in definition_after_data() | |
instance_form_save (\stdClass $datanew) | |
Saves the data coming from form. | |
instance_form_validation (array $data, array $files) | |
Validate the data on the field instance form. | |
restore_define_structure (\restore_structure_step $step, int $newid, int $oldid) | |
Callback for restore, allowing custom fields to restore additional data from the backup. | |
save () | |
Persistent save parser. | |
set ($property, $value) | |
Persistent setter parser. | |
to_record () | |
Persistent to_record parser. | |
Static Public Member Functions | |
static | create (int $id, ?\stdClass $record=null, ?field_controller $field=null) |
Creates an instance of data_controller. | |
Protected Member Functions | |
is_empty ($value) | |
Checks if the value is empty. | |
is_unique ($value) | |
Checks if the value is unique. | |
Protected Attributes | |
data | $data |
Data persistent. | |
field_controller | $field |
Field that this data belongs to. | |
|
inherited |
Callback for backup, allowing custom fields to add additional data to the backup.
It is not an abstract method for backward compatibility reasons.
backup_nested_element | $customfieldelement | The custom field element to be backed up. |
Reimplemented in customfield_textarea\data_controller.
|
staticinherited |
Creates an instance of data_controller.
Parameters $id, $record and $field can complement each other but not conflict. If $id is not specified, fieldid must be present either in $record or in $field. If $id is not specified, instanceid must be present in $record
No DB queries are performed if both $record and $field are specified.
int | $id | |
stdClass | null | $record | |
field_controller | null | $field |
data_controller |
coding_exception | |
moodle_exception |
customfield_number\data_controller::datafield | ( | ) |
Return the name of the field where the information is stored.
string |
Reimplemented from core_customfield\data_controller.
|
inherited |
Delete data.
Element can override it if related information needs to be deleted as well (such as files)
bool |
Reimplemented in customfield_textarea\data_controller.
|
inherited |
Used by handlers to display data on various places.
string |
customfield_number\data_controller::export_value | ( | ) |
Returns value in a human-readable format.
string|float|null |
Reimplemented from core_customfield\data_controller.
|
finalinherited |
Persistent getter parser.
string | $property |
mixed |
|
inherited |
Return the context of the field.
context |
customfield_number\data_controller::get_default_value | ( | ) |
Returns the default value in non human-readable format.
float|null |
Reimplemented from core_customfield\data_controller.
|
inherited |
Field associated with this data.
field_controller |
|
inherited |
Returns the name of the field to be used on HTML forms.
string |
Reimplemented in customfield_textarea\data_controller.
|
inherited |
Returns the value as it is stored in the database or default value if data record is not present.
mixed |
|
inherited |
Prepares the custom field data related to the object to pass to mform->set_data() and adds them to it.
This function must be called before calling $form->set_data($object);
stdClass | $instance | the instance that has custom fields, if 'id' attribute is present the custom fields for this instance will be added, otherwise the default values will be added. |
Reimplemented in customfield_textarea\data_controller.
|
abstractinherited |
Add a field to the instance edit form.
MoodleQuickForm | $mform |
Reimplemented in customfield_checkbox\data_controller, customfield_date\data_controller, customfield_select\data_controller, customfield_text\data_controller, and customfield_textarea\data_controller.
customfield_number\data_controller::instance_form_definition | ( | MoodleQuickForm | $mform | ) |
Add form elements for editing the custom field instance.
MoodleQuickForm | $mform |
|
inherited |
Called from instance edit form in definition_after_data()
MoodleQuickForm | $mform |
|
inherited |
Saves the data coming from form.
stdClass | $datanew | data coming from the form |
Reimplemented in customfield_textarea\data_controller.
customfield_number\data_controller::instance_form_validation | ( | array | $data, |
array | $files ) |
Validate the data on the field instance form.
array | $data | |
array | $files |
array |
Reimplemented from core_customfield\data_controller.
|
protected |
Checks if the value is empty.
mixed | $value |
bool |
Reimplemented from core_customfield\data_controller.
|
protectedinherited |
Checks if the value is unique.
mixed | $value |
bool |
Reimplemented in customfield_textarea\data_controller.
|
inherited |
Callback for restore, allowing custom fields to restore additional data from the backup.
It is not an abstract method for backward compatibility reasons.
restore_structure_step | $step | The restore step instance. |
int | $newid | The new ID for the custom field data after restore. |
int | $oldid | The original ID of the custom field data before backup. |
Reimplemented in customfield_textarea\data_controller.
|
inherited |
Persistent save parser.
void |
|
finalinherited |
Persistent setter parser.
string | $property | |
mixed | $value |
data |
|
finalinherited |
Persistent to_record parser.
stdClass |