Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Attributes | List of all members
MoodleQuickForm_filetypes Class Reference
Inheritance diagram for MoodleQuickForm_filetypes:
MoodleQuickForm_group templatable

Public Member Functions

 __construct ($elementname=null, $elementlabel=null, $options=null, $attributes=null)
 Constructor. More...
 
 _createElements ()
 Assemble the elements of the form control.
 
 accept (&$renderer, $required=false, $error=null)
 Accepts a renderer (called shortly before the renderer's toHtml() method). More...
 
 createFormElement ()
 Creates an element to add to the group Expects the same arguments as MoodleQuickForm::createElement()
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template. More...
 
 exportValue (&$submitted, $assoc=false)
 Return the selected file types. More...
 
 getElementTemplateType ()
 Returns element template, nodisplay/static/fieldset. More...
 
string getHelpButton ()
 template type, would cause problems with client side validation so will leave for now More...
 
 MoodleQuickForm_group ($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName=true)
 Old syntax of class constructor. More...
 
 onQuickFormEvent ($event, $arg, &$caller)
 Called by HTML_QuickForm whenever form event is made on this element. More...
 
 setElements ($elements)
 Sets the grouped elements and hides label. More...
 
 setMoodleForm ($mform)
 Stores the form this element was added to This object is later used by MoodleQuickForm_group::createElement(). More...
 
 validateSubmitValue ($value)
 Check that the submitted list contains only known and allowed file types. More...
 

Public Attributes

string $_helpbutton =''
 html for help button, if empty then no help
 

Protected Attributes

MoodleQuickForm $_mform = null
 
 $_renderedfromtemplate = false
 
bool $allowall = true
 Allow selection of 'All file types' (will be stored as '*').
 
bool $allowunknown = false
 Skip implicit validation against known file types.
 
array $onlytypes = []
 Allow selection from these file types only.
 
core_form filetypes_util $util = null
 instance to use as a helper.
 

Constructor & Destructor Documentation

◆ __construct()

MoodleQuickForm_filetypes::__construct (   $elementname = null,
  $elementlabel = null,
  $options = null,
  $attributes = null 
)

Constructor.

Parameters
string$elementnameElement's name
string$elementlabelLabel(s) for an element
array$optionselement options: 'onlytypes': Allow selection from these file types only; for example ['onlytypes' => ['web_image']]. 'allowall': Allow to select 'All file types', defaults to true. Does not apply with onlytypes are set. 'allowunknown': Skip implicit validation against the list of known file types.
array | string$attributesEither a typical HTML attribute string or an associative array

Member Function Documentation

◆ accept()

MoodleQuickForm_filetypes::accept ( $renderer,
  $required = false,
  $error = null 
)

Accepts a renderer (called shortly before the renderer's toHtml() method).

Parameters
HTML_QuickForm_Renderer$rendererAn HTML_QuickForm_Renderer object
bool$requiredWhether a group is required
string$errorAn error message associated with a group

Reimplemented from MoodleQuickForm_group.

◆ export_for_template()

MoodleQuickForm_group::export_for_template ( renderer_base  $output)
inherited

Function to export the renderer data in a format that is suitable for a mustache template.

This means:

  1. No complex types - only stdClass, array, int, string, float, bool
  2. Any additional info that is required for the template is pre-calculated (e.g. capability checks).
Parameters
renderer_base$outputUsed to do a final render of any components that need to be rendered for export.
Return values
stdClass|array

Implements templatable.

Reimplemented in MoodleQuickForm_date_time_selector, and MoodleQuickForm_date_selector.

◆ exportValue()

MoodleQuickForm_filetypes::exportValue ( $submitted,
  $assoc = false 
)

Return the selected file types.

Parameters
array$submittedsubmitted values
bool$associf true the retured value is associated array
Return values
array

◆ getElementTemplateType()

MoodleQuickForm_group::getElementTemplateType ( )
inherited

Returns element template, nodisplay/static/fieldset.

Return values
string

◆ getHelpButton()

string MoodleQuickForm_group::getHelpButton ( )
inherited

template type, would cause problems with client side validation so will leave for now

set html for help button

◆ MoodleQuickForm_group()

MoodleQuickForm_group::MoodleQuickForm_group (   $elementName = null,
  $elementLabel = null,
  $elements = null,
  $separator = null,
  $appendName = true 
)
inherited

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated:
since Moodle 3.1

◆ onQuickFormEvent()

MoodleQuickForm_filetypes::onQuickFormEvent (   $event,
  $arg,
$caller 
)

Called by HTML_QuickForm whenever form event is made on this element.

Parameters
string$eventName of event
mixed$argevent arguments
object$callercalling object
Return values
bool

Reimplemented from MoodleQuickForm_group.

◆ setElements()

MoodleQuickForm_group::setElements (   $elements)
inherited

Sets the grouped elements and hides label.

Parameters
array$elements

◆ setMoodleForm()

MoodleQuickForm_group::setMoodleForm (   $mform)
inherited

Stores the form this element was added to This object is later used by MoodleQuickForm_group::createElement().

Parameters
null | MoodleQuickForm$mform

◆ validateSubmitValue()

MoodleQuickForm_filetypes::validateSubmitValue (   $value)

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.

Parameters
array$valueSubmitted value.
Return values
string|nullValidation error message or null.

Reimplemented from MoodleQuickForm_group.


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