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

Public Member Functions

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

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. More...
 

Protected Member Functions

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

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

Member Data Documentation

◆ $urls

array url_select::$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')))


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