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

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.