Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
MoodleQuickForm_filepicker Class Reference

Filepicker form element. More...

Inheritance diagram for MoodleQuickForm_filepicker:
templatable

Public Member Functions

 __construct ($elementName=null, $elementLabel=null, $attributes=null, $options=null)
 Constructor.
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template.
 
 exportValue (&$submitValues, $assoc=false)
 export uploaded file
 
 getElementTemplateType ()
 Returns type of filepicker element.
 
 getHelpButton ()
 Returns html for help button.
 
 MoodleQuickForm_filepicker ($elementName=null, $elementLabel=null, $attributes=null, $options=null)
 Old syntax of class constructor.
 
 toHtml ()
 Returns HTML for filepicker form element.
 
 validateSubmitValue ($value)
 Check that the file has the allowed type.
 

Public Attributes

string $_helpbutton = ''
 html for help button, if empty then no help will icon will be dispalyed.
 

Protected Attributes

array $_options = array('maxbytes'=>0, 'accepted_types'=>'*', 'return_types'=>null)
 options provided to initalize filemanager
 

Detailed Description

Filepicker form element.

HTML class for a single filepicker element (based on button)

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

Constructor & Destructor Documentation

◆ __construct()

MoodleQuickForm_filepicker::__construct ( $elementName = null,
$elementLabel = null,
$attributes = null,
$options = null )

Constructor.

Parameters
string$elementName(optional) name of the filepicker
string$elementLabel(optional) filepicker label
array$attributes(optional) Either a typical HTML attribute string or an associative array
array$optionsset of options to initalize filepicker

Member Function Documentation

◆ export_for_template()

MoodleQuickForm_filepicker::export_for_template ( renderer_base $output)

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.

◆ exportValue()

MoodleQuickForm_filepicker::exportValue ( & $submitValues,
$assoc = false )

export uploaded file

Parameters
array$submitValuesvalues submitted.
bool$assocspecifies if returned array is associative
Return values
array

◆ getElementTemplateType()

MoodleQuickForm_filepicker::getElementTemplateType ( )

Returns type of filepicker element.

Return values
string

◆ getHelpButton()

MoodleQuickForm_filepicker::getHelpButton ( )

Returns html for help button.

Return values
stringhtml for help button

◆ MoodleQuickForm_filepicker()

MoodleQuickForm_filepicker::MoodleQuickForm_filepicker ( $elementName = null,
$elementLabel = null,
$attributes = null,
$options = null )

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated
since Moodle 3.1

◆ toHtml()

MoodleQuickForm_filepicker::toHtml ( )

Returns HTML for filepicker form element.

Return values
string

◆ validateSubmitValue()

MoodleQuickForm_filepicker::validateSubmitValue ( $value)

Check that the file has the allowed type.

Parameters
array$valueDraft item id with the uploaded files.
Return values
string|nullValidation error message or null.

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