Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401] [Versions 401 and 403]

(no description)

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

Defines 1 class

custom_fields:: (8 methods):
  __construct()
  add_join()
  add_joins()
  get_joins()
  get_columns()
  get_column_type()
  get_filters()
  get_filter_class_type()


Class: custom_fields  - X-Ref

Helper class for course custom fields.

__construct(string $tablefieldalias, string $entityname, string $component, string $area, int $itemid = 0)   X-Ref
Class customfields constructor.

param: string $tablefieldalias table alias and the field name (table.field) that matches the customfield instanceid.
param: string $entityname name of the entity in the report where we add custom fields.
param: string $component component name of full frankenstyle plugin name.
param: string $area name of the area (each component/plugin may define handlers for multiple areas).
param: int $itemid item id if the area uses them (usually not used).

add_join(string $join)   X-Ref
Additional join that is needed.

param: string $join
return: self

add_joins(array $joins)   X-Ref
Additional joins that are needed.

param: array $joins
return: self

get_joins()   X-Ref
Return joins

return: string[]

get_columns()   X-Ref
Gets the custom fields columns for the report.

Column will be named as 'customfield_' + customfield shortname.

return: column[]

get_column_type(field_controller $field, string $datafield)   X-Ref
Returns the column type

param: field_controller $field
param: string $datafield
return: int

get_filters()   X-Ref
Returns all available filters on custom fields.

Filter will be named as 'customfield_' + customfield shortname.

return: filter[]

get_filter_class_type(data_controller $datacontroller)   X-Ref
Returns class for the filter element that should be used for the field

In some situation we can assume what kind of data is stored in the customfield plugin and we can
display appropriate filter form element. For all others assume text filter.

param: data_controller $datacontroller
return: string