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 39 and 310]

Provides the {@link MoodleQuickForm_filetypes} class.

Copyright: 2016 Jonathon Fowler <fowlerj@usq.edu.au>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 254 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

MoodleQuickForm_filetypes:: (6 methods):
  __construct()
  _createElements()
  exportValue()
  accept()
  onQuickFormEvent()
  validateSubmitValue()


Class: MoodleQuickForm_filetypes  - X-Ref

File types and type groups selection form element.

__construct($elementname = null, $elementlabel = null, $options = null, $attributes = null)   X-Ref
Constructor

param: string $elementname Element's name
param: string $elementlabel Label(s) for an element
param: array $options element options:
param: array|string $attributes Either a typical HTML attribute string or an associative array

_createElements()   X-Ref
Assemble the elements of the form control.


exportValue(&$submitted, $assoc = false)   X-Ref
Return the selected file types.

param: array $submitted submitted values
param: bool $assoc if true the retured value is associated array
return: array

accept(&$renderer, $required = false, $error = null)   X-Ref
Accepts a renderer (called shortly before the renderer's toHtml() method).

param: HTML_QuickForm_Renderer $renderer An HTML_QuickForm_Renderer object
param: bool $required Whether a group is required
param: string $error An error message associated with a group

onQuickFormEvent($event, $arg, &$caller)   X-Ref
Called by HTML_QuickForm whenever form event is made on this element

param: string $event Name of event
param: mixed $arg event arguments
param: object $caller calling object
return: bool

validateSubmitValue($value)   X-Ref
Check that the submitted list contains only known and allowed file types.

The validation obeys the element options 'allowall', 'allowunknown' and
'onlytypes' passed when creating the element.

param: array $value Submitted value.
return: string|null Validation error message or null.