Differences Between: [Versions 310 and 311] [Versions 39 and 311]
Course handler for custom fields
Copyright: | 2018 David Matamoros <davidmc@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 241 lines (9 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
course_handler:: (12 methods):
create()
reset_caches()
can_configure()
can_edit()
can_view()
set_parent_context()
get_parent_context()
get_configuration_context()
get_configuration_url()
get_instance_context()
config_form_definition()
restore_instance_data_from_backup()
Class: course_handler - X-Ref
Course handler for custom fieldscreate(int $itemid = 0) X-Ref |
Returns a singleton param: int $itemid return: \core_course\customfield\course_handler |
reset_caches() X-Ref |
Run reset code after unit tests to reset the singleton usage. |
can_configure() X-Ref |
The current user can configure custom fields on this component. return: bool true if the current can configure custom fields, false otherwise |
can_edit(field_controller $field, int $instanceid = 0) X-Ref |
The current user can edit custom fields on the given course. param: field_controller $field param: int $instanceid id of the course to test edit permission return: bool true if the current can edit custom fields, false otherwise |
can_view(field_controller $field, int $instanceid) X-Ref |
The current user can view custom fields on the given course. param: field_controller $field param: int $instanceid id of the course to test edit permission return: bool true if the current can edit custom fields, false otherwise |
set_parent_context(\context $context) X-Ref |
Sets parent context for the course This may be needed when course is being created, there is no course context but we need to check capabilities param: \context $context |
get_parent_context() X-Ref |
Returns the parent context for the course return: \context |
get_configuration_context() X-Ref |
Context that should be used for new categories created by this handler return: \context the context for configuration |
get_configuration_url() X-Ref |
URL for configuration of the fields on this handler. return: \moodle_url The URL to configure custom fields for this component |
get_instance_context(int $instanceid = 0) X-Ref |
Returns the context for the data associated with the given instanceid. param: int $instanceid id of the record to get the context for return: \context the context for the given record |
config_form_definition(\MoodleQuickForm $mform) X-Ref |
Allows to add custom controls to the field configuration form that will be saved in configdata param: \MoodleQuickForm $mform |
restore_instance_data_from_backup(\restore_task $task, array $data) X-Ref |
Creates or updates custom field data. param: \restore_task $task param: array $data |