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

Simple URL selection widget description. More...

Inheritance diagram for url_select:
renderable templatable

Public Member Functions

 __construct (array $urls, $selected='', $nothing=array(''=> 'choosedots'), $formid=null, $showbutton=null)
 Constructor.
 
 export_for_template (renderer_base $output)
 Export for template.
 
 set_help_icon ($identifier, $component='moodle')
 Adds help icon.
 
 set_label ($label, $attributes=array())
 Sets select's label.
 
 set_old_help_icon ($helppage, $title, $component='moodle')
 Adds help icon.
 

Public Attributes

array $attributes = array()
 Extra select field attributes.
 
string $class = 'urlselect'
 Wrapping div class.
 
bool $disabled = false
 True if button disabled, false if normal.
 
string $formid = null
 Form id.
 
help_icon $helpicon = null
 The help icon for this element.
 
string $label = ''
 Button label.
 
array $labelattributes = array()
 Button label's attributes.
 
array $nothing
 Nothing selected.
 
string $selected
 Selected option.
 
string $showbutton = null
 If set, makes button visible with given name for button.
 
string $tooltip = null
 Button tooltip.
 
array $urls
 $urls associative array value=>label ex.: array(1=>'One, 2=>Two) it is also possible to specify optgroup as complex label array ex.: array(array('Odd'=>array(1=>'One', 3=>'Three)), array('Even'=>array(2=>'Two'))) array(1=>'One', '–1uniquekey'=>array('More'=>array(2=>'Two', 3=>'Three')))
 

Protected Member Functions

 clean_url ($value)
 Clean a URL.
 
 flatten_options ($options, $nothing)
 Flatten the options for Mustache.
 

Detailed Description

Simple URL selection widget description.

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

Constructor & Destructor Documentation

◆ __construct()

url_select::__construct ( array $urls,
$selected = '',
$nothing = array('' => 'choosedots'),
$formid = null,
$showbutton = null )

Constructor.

Parameters
array$urlslist of options
string$selectedselected element
array$nothing
string$formid
string$showbuttonSet to text of button if it should be visible or null if it should be hidden (hidden version always has text 'go')

Member Function Documentation

◆ clean_url()

url_select::clean_url ( $value)
protected

Clean a URL.

Parameters
string$valueThe URL.
Return values
Thecleaned URL.

◆ export_for_template()

url_select::export_for_template ( renderer_base $output)

Export for template.

Parameters
renderer_base$outputRenderer.
Return values
stdClass

Implements templatable.

◆ flatten_options()

url_select::flatten_options ( $options,
$nothing )
protected

Flatten the options for Mustache.

This also cleans the URLs.

Parameters
array$optionsThe options.
array$nothingThe nothing option.
Return values
array

◆ set_help_icon()

url_select::set_help_icon ( $identifier,
$component = 'moodle' )

Adds help icon.

Parameters
string$identifierThe keyword that defines a help page
string$component

◆ set_label()

url_select::set_label ( $label,
$attributes = array() )

Sets select's label.

Parameters
string$label
array$attributes(optional)

◆ set_old_help_icon()

url_select::set_old_help_icon ( $helppage,
$title,
$component = 'moodle' )

Adds help icon.

Deprecated
since Moodle 2.0

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