Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Attributes | List of all members
MoodleQuickForm_searchableselector Class Reference

Form field type for selecting from a list of options. More...

Inheritance diagram for MoodleQuickForm_searchableselector:
MoodleQuickForm_autocomplete MoodleQuickForm_select templatable

Public Member Functions

 __construct ($elementname=null, $elementlabel=null, $options=[], $attributes=[])
 Constructor. More...
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template. More...
 
 exportValue (&$submitValues, $assoc=false)
 Returns a 'safe' element's value. More...
 
 getElementTemplateType ()
 Slightly different container template when frozen. More...
 
 getHelpButton ()
 get html for help button More...
 
 MoodleQuickForm_autocomplete ($elementName=null, $elementLabel=null, $options=null, $attributes=null)
 Old syntax of class constructor. More...
 
 MoodleQuickForm_searchableselector ($elementName=null, $elementLabel=null, $options=null, $attributes=null)
 Old syntax of class constructor. More...
 
 MoodleQuickForm_select ($elementName=null, $elementLabel=null, $options=null, $attributes=null)
 Old syntax of class constructor. More...
 
 onQuickFormEvent ($event, $arg, &$caller)
 Called by HTML_QuickForm whenever form event is made on this element. More...
 
 optionExists ($value)
 Search the current list of options to see if there are any options with this value. More...
 
 removeOption ($value)
 Removes an OPTION from the SELECT. More...
 
 removeOptions ()
 Removes all OPTIONs from the SELECT.
 
 setHiddenLabel ($hiddenLabel)
 Sets label to be hidden. More...
 
 setValue ($value)
 Set the value of this element. More...
 
 toHtml ()
 Returns HTML for select form element. More...
 

Public Attributes

string $_helpbutton =''
 html for help button, if empty then no help
 
bool $_hiddenLabel =false
 if true label will be hidden
 

Protected Attributes

string $ajax = ''
 $ajax Name of an AMD module to send/process ajax requests.
 
bool $casesensitive = false
 $casesensitive Whether the search has to be case-sensitive.
 
string $noselectionstring = ''
 $noselectionstring String that is shown when there are no selections.
 
string $placeholder = ''
 $placeholder Placeholder text for an empty list.
 
bool $showsuggestions = true
 $showsuggestions Show suggestions by default - but this can be turned off.
 
boolean $tags = false
 $tags Should we allow typing new entries to the field?
 
callable null $valuehtmlcallback = null
 Function to call (with existing value) to render it to HTML.
 

Detailed Description

Form field type for selecting from a list of options.

Allows auto-complete ajax searching.

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

Constructor & Destructor Documentation

◆ __construct()

MoodleQuickForm_searchableselector::__construct (   $elementname = null,
  $elementlabel = null,
  $options = [],
  $attributes = [] 
)

Constructor.

Parameters
string$elementnameElement name
mixed$elementlabelLabel(s) for an element
array$optionsList of valid options for the select
array$attributesList of HTML attributes for the select

Reimplemented from MoodleQuickForm_autocomplete.

Member Function Documentation

◆ export_for_template()

MoodleQuickForm_autocomplete::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

Reimplemented from MoodleQuickForm_select.

Reimplemented in MoodleQuickForm_tags.

◆ exportValue()

MoodleQuickForm_autocomplete::exportValue ( $submitValues,
  $assoc = false 
)
inherited

Returns a 'safe' element's value.

Parameters
arrayarray of submitted values to search
boolwhether to return the value as associative array
Return values
mixed

Reimplemented from MoodleQuickForm_select.

Reimplemented in MoodleQuickForm_tags.

◆ getElementTemplateType()

MoodleQuickForm_select::getElementTemplateType ( )
inherited

Slightly different container template when frozen.

Don't want to use a label tag with a for attribute in that case for the element label but instead use a div. Templates are defined in renderer constructor.

Return values
string

◆ getHelpButton()

MoodleQuickForm_select::getHelpButton ( )
inherited

get html for help button

Return values
stringhtml for help button

◆ MoodleQuickForm_autocomplete()

MoodleQuickForm_autocomplete::MoodleQuickForm_autocomplete (   $elementName = null,
  $elementLabel = null,
  $options = null,
  $attributes = null 
)
inherited

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated:
since Moodle 3.1

◆ MoodleQuickForm_searchableselector()

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

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated:
since Moodle 3.1

◆ MoodleQuickForm_select()

MoodleQuickForm_select::MoodleQuickForm_select (   $elementName = null,
  $elementLabel = null,
  $options = null,
  $attributes = null 
)
inherited

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated:
since Moodle 3.1

◆ onQuickFormEvent()

MoodleQuickForm_autocomplete::onQuickFormEvent (   $event,
  $arg,
$caller 
)
inherited

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 in MoodleQuickForm_tags.

◆ optionExists()

MoodleQuickForm_autocomplete::optionExists (   $value)
inherited

Search the current list of options to see if there are any options with this value.

Parameters
string$valueto search
Return values
boolean

◆ removeOption()

MoodleQuickForm_select::removeOption (   $value)
inherited

Removes an OPTION from the SELECT.

Parameters
string$valueValue for the OPTION to remove
Return values
void

◆ setHiddenLabel()

MoodleQuickForm_select::setHiddenLabel (   $hiddenLabel)
inherited

Sets label to be hidden.

Parameters
bool$hiddenLabelsets if label should be hidden

◆ setValue()

MoodleQuickForm_autocomplete::setValue (   $value)
inherited

Set the value of this element.

If values can be added or are unknown, we will make sure they exist in the options array.

Parameters
mixedstring|array $value The value to set.
Return values
boolean

Reimplemented in MoodleQuickForm_course, MoodleQuickForm_cohort, and tool_lp\form\framework_autocomplete.

◆ toHtml()

MoodleQuickForm_autocomplete::toHtml ( )
inherited

Returns HTML for select form element.

Return values
string

Reimplemented from MoodleQuickForm_select.

Reimplemented in MoodleQuickForm_tags.


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