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.

Customfield catecory controller class

Copyright: 2018 Toni Barbera <toni@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 231 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

category_controller:: (12 methods):
  __construct()
  create()
  get()
  set()
  delete()
  save()
  get_fields()
  add_field()
  get_handler()
  set_handler()
  to_record()
  get_formatted_name()


Class: category_controller  - X-Ref

Class category

__construct(int $id = 0, \stdClass $record = null)   X-Ref
category constructor.

This class is not abstract, however the constructor was made protected to be consistent with
field_controller and data_controller

param: int $id
param: \stdClass|null $record

create(int $id, \stdClass $record = null, handler $handler = null)   X-Ref
Creates an instance of category_controller

Either $id or $record or $handler need to be specified
If handler is known pass it to constructor to avoid retrieving it later
Component, area and itemid must not conflict with the ones in handler

param: int $id
param: \stdClass|null $record
param: handler|null $handler
return: category_controller

get($property)   X-Ref
Persistent getter parser.

param: string $property
return: mixed

set($property, $value)   X-Ref
Persistent setter parser.

param: string $property
param: mixed $value

delete()   X-Ref
Persistent delete parser.

return: bool

save()   X-Ref
Persistent save parser.

return: void

get_fields()   X-Ref
Return an array of field objects associated with this category.

return: field_controller[]

add_field(field_controller $field)   X-Ref
Adds a child field

param: field_controller $field

get_handler()   X-Ref
Gets a handler, if not known retrieve it

return: handler

set_handler(handler $handler)   X-Ref
Allows to set handler so we don't need to retrieve it later

param: handler $handler

to_record()   X-Ref
Persistent to_record parser.

return: \stdClass

get_formatted_name()   X-Ref
Returns the category name formatted according to configuration context.

return: string