Base class for custom fields data controllers.
More...
|
| is_empty ($value) |
| Checks if the value is empty.
|
|
| is_unique ($value) |
| Checks if the value is unique.
|
|
Base class for custom fields data controllers.
This class is a wrapper around the persistent data class that allows to define how the element behaves in the instance edit forms.
Custom field plugins must define a class {pluginname}data_controller extends core_customfield\data_controller
- Copyright
- 2018 Toni Barbera toni@.nosp@m.mood.nosp@m.le.co.nosp@m.m
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
core_customfield\data_controller::__construct |
( |
int | $id, |
|
|
stdClass | $record ) |
data_controller constructor.
- Parameters
-
int | $id | |
stdClass | null | $record | |
◆ create()
static core_customfield\data_controller::create |
( |
int | $id, |
|
|
stdClass | $record = null, |
|
|
field_controller | $field = null ) |
|
static |
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
-
- Exceptions
-
◆ datafield()
core_customfield\data_controller::datafield |
( |
| ) |
|
|
abstract |
◆ delete()
core_customfield\data_controller::delete |
( |
| ) |
|
◆ display()
core_customfield\data_controller::display |
( |
| ) |
|
Used by handlers to display data on various places.
- Return values
-
◆ export_value()
core_customfield\data_controller::export_value |
( |
| ) |
|
◆ get()
core_customfield\data_controller::get |
( |
| $property | ) |
|
|
final |
Persistent getter parser.
- Parameters
-
- Return values
-
◆ get_context()
core_customfield\data_controller::get_context |
( |
| ) |
|
Return the context of the field.
- Return values
-
◆ get_default_value()
core_customfield\data_controller::get_default_value |
( |
| ) |
|
|
abstract |
◆ get_field()
core_customfield\data_controller::get_field |
( |
| ) |
|
Field associated with this data.
- Return values
-
◆ get_form_element_name()
core_customfield\data_controller::get_form_element_name |
( |
| ) |
|
◆ get_value()
core_customfield\data_controller::get_value |
( |
| ) |
|
Returns the value as it is stored in the database or default value if data record is not present.
- Return values
-
◆ instance_form_before_set_data()
core_customfield\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 | $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.
◆ instance_form_definition()
core_customfield\data_controller::instance_form_definition |
( |
\MoodleQuickForm | $mform | ) |
|
|
abstract |
◆ instance_form_definition_after_data()
core_customfield\data_controller::instance_form_definition_after_data |
( |
\MoodleQuickForm | $mform | ) |
|
Called from instance edit form in definition_after_data()
- Parameters
-
◆ instance_form_save()
core_customfield\data_controller::instance_form_save |
( |
\stdClass | $datanew | ) |
|
◆ instance_form_validation()
core_customfield\data_controller::instance_form_validation |
( |
array | $data, |
|
|
array | $files ) |
◆ is_empty()
core_customfield\data_controller::is_empty |
( |
| $value | ) |
|
|
protected |
◆ is_unique()
core_customfield\data_controller::is_unique |
( |
| $value | ) |
|
|
protected |
◆ save()
core_customfield\data_controller::save |
( |
| ) |
|
Persistent save parser.
- Return values
-
◆ set()
core_customfield\data_controller::set |
( |
| $property, |
|
|
| $value ) |
|
final |
Persistent setter parser.
- Parameters
-
string | $property | |
mixed | $value | |
- Return values
-
◆ to_record()
core_customfield\data_controller::to_record |
( |
| ) |
|
|
final |
Persistent to_record parser.
- Return values
-
The documentation for this class was generated from the following file: