Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Api customfield package

Copyright: 2018 David Matamoros <davidmc@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 442 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: api  - X-Ref

Class api

get_instance_fields_data(array $fields, int $instanceid, bool $adddefaults = true)   X-Ref
For the given instance and list of fields fields retrieves data associated with them

param: field_controller[] $fields list of fields indexed by field id
param: int $instanceid
param: bool $adddefaults
return: data_controller[] array of data_controller objects indexed by fieldid. All fields are present,

get_instances_fields_data(array $fields, array $instanceids, bool $adddefaults = true)   X-Ref
For given list of instances and fields retrieves data associated with them

param: field_controller[] $fields list of fields indexed by field id
param: int[] $instanceids
param: bool $adddefaults
return: data_controller[][] 2-dimension array, first index is instanceid, second index is fieldid.

get_available_field_types()   X-Ref
Retrieve a list of all available custom field types

return: array   a list of the fieldtypes suitable to use in a select statement

save_field_configuration(field_controller $field, \stdClass $formdata)   X-Ref
Updates or creates a field with data that came from a form

param: field_controller $field
param: \stdClass $formdata

move_field(field_controller $field, int $categoryid, int $beforeid = 0)   X-Ref
Change fields sort order, move field to another category

param: field_controller $field field that needs to be moved
param: int $categoryid category that needs to be moved
param: int $beforeid id of the category this category needs to be moved before, 0 to move to the end

delete_field_configuration(field_controller $field)   X-Ref
Delete a field

param: field_controller $field

get_category_inplace_editable(category_controller $category, bool $editable = true)   X-Ref
Returns an object for inplace editable

param: category_controller $category category that needs to be moved
param: bool $editable
return: inplace_editable

move_category(category_controller $category, int $beforeid = 0)   X-Ref
Reorder categories, move given category before another category

param: category_controller $category category that needs to be moved
param: int $beforeid id of the category this category needs to be moved before, 0 to move to the end

save_category(category_controller $category)   X-Ref
Insert or update custom field category

param: category_controller $category

delete_category(category_controller $category)   X-Ref
Delete a custom field category

param: category_controller $category
return: bool

get_categories_with_fields(string $component, string $area, int $itemid)   X-Ref
Returns a list of categories with their related fields.

param: string $component
param: string $area
param: int $itemid
return: category_controller[]

prepare_field_for_config_form(field_controller $field)   X-Ref
Prepares the object to pass to field configuration form set_data() method

param: field_controller $field
return: \stdClass

get_fields_supporting_course_grouping()   X-Ref
Get a list of the course custom fields that support course grouping in
block_myoverview

return: array $shortname => $name