Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
customfield_select\data_controller Class Reference

Class data. More...

Inheritance diagram for customfield_select\data_controller:

Public Member Functions

 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 as it would be stored in the database (not in 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 fields for editing a textarea field.
 
 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)
 Validates data for this field.
 
 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.
 

Detailed Description

Class data.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ create()

static core_customfield\data_controller::create ( int $id,
stdClass $record = null,
field_controller $field = null )
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.

Parameters
int$id
stdClass | null$record
field_controller | null$field
Return values
data_controller
Exceptions
coding_exception
moodle_exception

◆ datafield()

customfield_select\data_controller::datafield ( )

Return the name of the field where the information is stored.

Return values
string

Reimplemented from core_customfield\data_controller.

◆ delete()

core_customfield\data_controller::delete ( )
inherited

Delete data.

Element can override it if related information needs to be deleted as well (such as files)

Return values
bool

Reimplemented in customfield_textarea\data_controller.

◆ display()

core_customfield\data_controller::display ( )
inherited

Used by handlers to display data on various places.

Return values
string

◆ export_value()

customfield_select\data_controller::export_value ( )

Returns value in a human-readable format.

Return values
mixed|nullvalue or null if empty

Reimplemented from core_customfield\data_controller.

◆ get()

core_customfield\data_controller::get ( $property)
finalinherited

Persistent getter parser.

Parameters
string$property
Return values
mixed

◆ get_context()

core_customfield\data_controller::get_context ( )
inherited

Return the context of the field.

Return values
context

◆ get_default_value()

customfield_select\data_controller::get_default_value ( )

Returns the default value as it would be stored in the database (not in human-readable format).

Return values
mixed

Reimplemented from core_customfield\data_controller.

◆ get_field()

core_customfield\data_controller::get_field ( )
inherited

Field associated with this data.

Return values
field_controller

◆ get_form_element_name()

core_customfield\data_controller::get_form_element_name ( )
inherited

Returns the name of the field to be used on HTML forms.

Return values
string

Reimplemented in customfield_textarea\data_controller.

◆ get_value()

core_customfield\data_controller::get_value ( )
inherited

Returns the value as it is stored in the database or default value if data record is not present.

Return values
mixed

◆ instance_form_before_set_data()

core_customfield\data_controller::instance_form_before_set_data ( \stdClass $instance)
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);

Parameters
stdClass$instancethe 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.

◆ instance_form_definition()

customfield_select\data_controller::instance_form_definition ( \MoodleQuickForm $mform)

Add fields for editing a textarea field.

Parameters
MoodleQuickForm$mform

Reimplemented from core_customfield\data_controller.

◆ instance_form_definition_after_data()

core_customfield\data_controller::instance_form_definition_after_data ( \MoodleQuickForm $mform)
inherited

Called from instance edit form in definition_after_data()

Parameters
MoodleQuickForm$mform

◆ instance_form_save()

core_customfield\data_controller::instance_form_save ( \stdClass $datanew)
inherited

Saves the data coming from form.

Parameters
stdClass$datanewdata coming from the form

Reimplemented in customfield_textarea\data_controller.

◆ instance_form_validation()

customfield_select\data_controller::instance_form_validation ( array $data,
array $files )

Validates data for this field.

Parameters
array$data
array$files
Return values
array

Reimplemented from core_customfield\data_controller.

◆ is_empty()

core_customfield\data_controller::is_empty ( $value)
protectedinherited

Checks if the value is empty.

Parameters
mixed$value
Return values
bool

Reimplemented in customfield_textarea\data_controller.

◆ is_unique()

core_customfield\data_controller::is_unique ( $value)
protectedinherited

Checks if the value is unique.

Parameters
mixed$value
Return values
bool

Reimplemented in customfield_textarea\data_controller.

◆ save()

core_customfield\data_controller::save ( )
inherited

Persistent save parser.

Return values
void

◆ set()

core_customfield\data_controller::set ( $property,
$value )
finalinherited

Persistent setter parser.

Parameters
string$property
mixed$value
Return values
data

◆ to_record()

core_customfield\data_controller::to_record ( )
finalinherited

Persistent to_record parser.

Return values
stdClass

The documentation for this class was generated from the following file: