Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

(no description)

File Size: 124 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

cohort_handler:: (8 methods):
  create()
  reset_caches()
  can_configure()
  can_edit()
  can_view()
  get_configuration_context()
  get_configuration_url()
  get_instance_context()


Class: cohort_handler  - X-Ref

Cohort handler for custom fields.

create(int $itemid = 0)   X-Ref
Returns a singleton.

param: int $itemid
return: \core_customfield\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 cohort.

param: field_controller $field
param: int $instanceid id of the cohort to test edit permission
return: bool true if the current can edit custom field, false otherwise

can_view(field_controller $field, int $instanceid)   X-Ref
The current user can view custom fields on the given cohort.

param: field_controller $field
param: int $instanceid id of the cohort to test edit permission
return: bool true if the current can view custom field, false otherwise

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