Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core_customfield\api Class Reference

Class api. More...

Static Public Member Functions

static delete_category (category_controller $category)
 Delete a custom field category.
 
static delete_field_configuration (field_controller $field)
 Delete a field.
 
static get_available_field_types ()
 Retrieve a list of all available custom field types.
 
static get_categories_with_fields (string $component, string $area, int $itemid)
 Returns a list of categories with their related fields.
 
static get_category_inplace_editable (category_controller $category, bool $editable=true)
 Returns an object for inplace editable.
 
static get_fields_supporting_course_grouping ()
 Get a list of the course custom fields that support course grouping in block_myoverview.
 
static get_instance_fields_data (array $fields, int $instanceid, bool $adddefaults=true)
 For the given instance and list of fields fields retrieves data associated with them.
 
static get_instances_fields_data (array $fields, array $instanceids, bool $adddefaults=true)
 For given list of instances and fields retrieves data associated with them.
 
static move_category (category_controller $category, int $beforeid=0)
 Reorder categories, move given category before another category.
 
static move_field (field_controller $field, int $categoryid, int $beforeid=0)
 Change fields sort order, move field to another category.
 
static prepare_field_for_config_form (field_controller $field)
 Prepares the object to pass to field configuration form set_data() method.
 
static save_category (category_controller $category)
 Insert or update custom field category.
 
static save_field_configuration (field_controller $field, stdClass $formdata)
 Updates or creates a field with data that came from a form.
 

Detailed Description

Class api.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ delete_category()

static core_customfield\api::delete_category ( category_controller $category)
static

Delete a custom field category.

Parameters
category_controller$category
Return values
bool

◆ delete_field_configuration()

static core_customfield\api::delete_field_configuration ( field_controller $field)
static

Delete a field.

Parameters
field_controller$field

◆ get_available_field_types()

static core_customfield\api::get_available_field_types ( )
static

Retrieve a list of all available custom field types.

Return values
arraya list of the fieldtypes suitable to use in a select statement

◆ get_categories_with_fields()

static core_customfield\api::get_categories_with_fields ( string $component,
string $area,
int $itemid )
static

Returns a list of categories with their related fields.

Parameters
string$component
string$area
int$itemid
Return values
category_controller[]

◆ get_category_inplace_editable()

static core_customfield\api::get_category_inplace_editable ( category_controller $category,
bool $editable = true )
static

Returns an object for inplace editable.

Parameters
category_controller$categorycategory that needs to be moved
bool$editable
Return values
inplace_editable

◆ get_fields_supporting_course_grouping()

static core_customfield\api::get_fields_supporting_course_grouping ( )
static

Get a list of the course custom fields that support course grouping in block_myoverview.

Return values
array\$shortname=> $name

◆ get_instance_fields_data()

static core_customfield\api::get_instance_fields_data ( array $fields,
int $instanceid,
bool $adddefaults = true )
static

For the given instance and list of fields fields retrieves data associated with them.

Parameters
field_controller[]$fieldslist of fields indexed by field id
int$instanceid
bool$adddefaults
Return values
data_controller[]array of data_controller objects indexed by fieldid. All fields are present, some data_controller objects may have 'id', some not If ($adddefaults): All fieldids are present, some data_controller objects may have 'id', some not. If (!$adddefaults): Only fieldids with data are present, all data_controller objects have 'id'.

◆ get_instances_fields_data()

static core_customfield\api::get_instances_fields_data ( array $fields,
array $instanceids,
bool $adddefaults = true )
static

For given list of instances and fields retrieves data associated with them.

Parameters
field_controller[]$fieldslist of fields indexed by field id
int[]$instanceids
bool$adddefaults
Return values
data_controller[][]2-dimension array, first index is instanceid, second index is fieldid. If ($adddefaults): All instanceids and all fieldids are present, some data_controller objects may have 'id', some not. If (!$adddefaults): All instanceids are present but only fieldids with data are present, all data_controller objects have 'id'.

◆ move_category()

static core_customfield\api::move_category ( category_controller $category,
int $beforeid = 0 )
static

Reorder categories, move given category before another category.

Parameters
category_controller$categorycategory that needs to be moved
int$beforeidid of the category this category needs to be moved before, 0 to move to the end

◆ move_field()

static core_customfield\api::move_field ( field_controller $field,
int $categoryid,
int $beforeid = 0 )
static

Change fields sort order, move field to another category.

Parameters
field_controller$fieldfield that needs to be moved
int$categoryidcategory that needs to be moved
int$beforeidid of the category this category needs to be moved before, 0 to move to the end

◆ prepare_field_for_config_form()

static core_customfield\api::prepare_field_for_config_form ( field_controller $field)
static

Prepares the object to pass to field configuration form set_data() method.

Parameters
field_controller$field
Return values
stdClass

◆ save_category()

static core_customfield\api::save_category ( category_controller $category)
static

Insert or update custom field category.

Parameters
category_controller$category

◆ save_field_configuration()

static core_customfield\api::save_field_configuration ( field_controller $field,
stdClass $formdata )
static

Updates or creates a field with data that came from a form.

Parameters
field_controller$field
stdClass$formdata

The documentation for this class was generated from the following file: