File types and type groups selection form element.
More...
|
| __construct ($elementname=null, $elementlabel=null, $options=null, $attributes=null) |
| Constructor.
|
|
| _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).
|
|
| 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.
|
|
| exportValue (&$submitted, $assoc=false) |
| Return the selected file types.
|
|
| getAttributesForFormElement () |
| Return attributes suitable for passing to {.
|
|
| getElementTemplateType () |
| Returns element template, nodisplay/static/fieldset.
|
|
string | getHelpButton () |
| template type, would cause problems with client side validation so will leave for now
|
|
| MoodleQuickForm_group ($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName=true) |
| Old syntax of class constructor.
|
|
| onQuickFormEvent ($event, $arg, &$caller) |
| Called by HTML_QuickForm whenever form event is made on this element.
|
|
| setElements ($elements) |
| Sets the grouped elements and hides label.
|
|
| setHiddenLabel ($hiddenLabel) |
| Sets label to be hidden.
|
|
| setMoodleForm ($mform) |
| Stores the form this element was added to This object is later used by MoodleQuickForm_group::createElement().
|
|
| validateSubmitValue ($value) |
| Check that the submitted list contains only known and allowed file types.
|
|
|
string | $_helpbutton ='' |
| html for help button, if empty then no help
|
|
|
bool | $_hiddenLabel = false |
| if true label will be hidden.
|
|
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.
|
|
File types and type groups selection form element.
- Copyright
- 2016 Jonathon Fowler fowle.nosp@m.rj@u.nosp@m.sq.ed.nosp@m.u.au
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
MoodleQuickForm_filetypes::__construct |
( |
| $elementname = null, |
|
|
| $elementlabel = null, |
|
|
| $options = null, |
|
|
| $attributes = null ) |
Constructor.
- Parameters
-
string | $elementname | Element's name |
string | $elementlabel | Label(s) for an element |
array | $options | element 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 | $attributes | Either a typical HTML attribute string or an associative array |
◆ accept()
MoodleQuickForm_filetypes::accept |
( |
& | $renderer, |
|
|
| $required = false, |
|
|
| $error = null ) |
Accepts a renderer (called shortly before the renderer's toHtml() method).
- Parameters
-
HTML_QuickForm_Renderer | $renderer | An HTML_QuickForm_Renderer object |
bool | $required | Whether a group is required |
string | $error | An 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:
- No complex types - only stdClass, array, int, string, float, bool
- Any additional info that is required for the template is pre-calculated (e.g. capability checks).
- Parameters
-
renderer_base | $output | Used to do a final render of any components that need to be rendered for export. |
- Return values
-
Implements templatable.
Reimplemented in MoodleQuickForm_date_selector, and MoodleQuickForm_date_time_selector.
◆ exportValue()
MoodleQuickForm_filetypes::exportValue |
( |
& | $submitted, |
|
|
| $assoc = false ) |
Return the selected file types.
- Parameters
-
array | $submitted | submitted values |
bool | $assoc | if true the retured value is associated array |
- Return values
-
◆ getAttributesForFormElement()
MoodleQuickForm_group::getAttributesForFormElement |
( |
| ) |
|
|
inherited |
Return attributes suitable for passing to {.
- See also
- createFormElement}, comprised of all group attributes without ID in order to ensure uniqueness of that value within the group
- Return values
-
◆ getElementTemplateType()
MoodleQuickForm_group::getElementTemplateType |
( |
| ) |
|
|
inherited |
Returns element template, nodisplay/static/fieldset.
- Return values
-
◆ 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 |
◆ onQuickFormEvent()
MoodleQuickForm_filetypes::onQuickFormEvent |
( |
| $event, |
|
|
| $arg, |
|
|
& | $caller ) |
Called by HTML_QuickForm whenever form event is made on this element.
- Parameters
-
string | $event | Name of event |
mixed | $arg | event arguments |
object | $caller | calling object |
- Return values
-
Reimplemented from MoodleQuickForm_group.
◆ setElements()
MoodleQuickForm_group::setElements |
( |
| $elements | ) |
|
|
inherited |
Sets the grouped elements and hides label.
- Parameters
-
◆ setHiddenLabel()
MoodleQuickForm_group::setHiddenLabel |
( |
| $hiddenLabel | ) |
|
|
inherited |
Sets label to be hidden.
- Parameters
-
bool | $hiddenLabel | sets if label should be hidden |
◆ setMoodleForm()
MoodleQuickForm_group::setMoodleForm |
( |
| $mform | ) |
|
|
inherited |
◆ 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 | $value | Submitted value. |
- Return values
-
string|null | Validation error message or null. |
Reimplemented from MoodleQuickForm_group.
The documentation for this class was generated from the following file: