Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
customfield_textarea\data_controller Class Reference

Class data. More...

Inheritance diagram for customfield_textarea\data_controller:
core_customfield\data_controller

Public Member Functions

 backup_define_structure (backup_nested_element $customfieldelement)
 Implement the backup callback for the custom field element.
 
 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)
 Called from instance edit form in validation()
 
 restore_define_structure (\restore_structure_step $step, int $newid, int $oldid)
 Implement the restore callback for the custom field element.
 
 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, overriding the base method to ensure it's the "text" element of our value being compared.
 
 is_unique ($value)
 Checks if the value is unique, overriding the base method to ensure it's the "text" element of our value being compared.
 
 value_editor_options ()
 Options for the editor.
 

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

◆ backup_define_structure()

customfield_textarea\data_controller::backup_define_structure ( backup_nested_element $customfieldelement)

Implement the backup callback for the custom field element.

This includes any embedded files in the custom field element.

Parameters
backup_nested_element$customfieldelementThe custom field element to be backed up.

Reimplemented from core_customfield\data_controller.

◆ 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_textarea\data_controller::datafield ( )

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

Return values
string

Reimplemented from core_customfield\data_controller.

◆ delete()

customfield_textarea\data_controller::delete ( )

Delete data.

Return values
bool

Reimplemented from core_customfield\data_controller.

◆ display()

core_customfield\data_controller::display ( )
inherited

Used by handlers to display data on various places.

Return values
string

◆ export_value()

customfield_textarea\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_textarea\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()

customfield_textarea\data_controller::get_form_element_name ( )

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

Return values
string

Reimplemented from core_customfield\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()

customfield_textarea\data_controller::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.

This function must be called before calling $form->set_data($object);

Parameters
stdClass$instancethe entity that has custom fields, if 'id' attribute is present the custom fields for this entity will be added, otherwise the default values will be added.

Reimplemented from core_customfield\data_controller.

◆ instance_form_definition()

customfield_textarea\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()

customfield_textarea\data_controller::instance_form_save ( \stdClass $datanew)

Saves the data coming from form.

Parameters
stdClass$datanewdata coming from the form

Reimplemented from core_customfield\data_controller.

◆ instance_form_validation()

core_customfield\data_controller::instance_form_validation ( array $data,
array $files )
inherited

Called from instance edit form in validation()

Parameters
array$data
array$files
Return values
arrayarray of errors

Reimplemented in customfield_date\data_controller, customfield_select\data_controller, and customfield_text\data_controller.

◆ is_empty()

customfield_textarea\data_controller::is_empty ( $value)
protected

Checks if the value is empty, overriding the base method to ensure it's the "text" element of our value being compared.

Parameters
string | string[]$value
Return values
bool

Reimplemented from core_customfield\data_controller.

◆ is_unique()

customfield_textarea\data_controller::is_unique ( $value)
protected

Checks if the value is unique, overriding the base method to ensure it's the "text" element of our value being compared.

Parameters
mixed$value
Return values
bool

Reimplemented from core_customfield\data_controller.

◆ restore_define_structure()

customfield_textarea\data_controller::restore_define_structure ( \restore_structure_step $step,
int $newid,
int $oldid )

Implement the restore callback for the custom field element.

This includes restoring any embedded files in the custom field element.

Parameters
restore_structure_step$stepThe restore step instance.
int$newidThe new ID for the custom field data after restore.
int$oldidThe original ID of the custom field data before backup.

Reimplemented from core_customfield\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

◆ value_editor_options()

customfield_textarea\data_controller::value_editor_options ( )
protected

Options for the editor.

Return values
array

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