PHP 클래스 dokuwiki\Form\DropdownElement

Represents a HTML select. Please note that this does not support multiple selected options!
상속: extends dokuwiki\Form\InputElement
파일 보기 프로젝트 열기: splitbrain/dokuwiki

보호된 프로퍼티들

프로퍼티 타입 설명
$optGroups OptGroup[]

공개 메소드들

메소드 설명
__construct ( string $name, array $options, string $label = '' )
addOptGroup ( string $label, array $options ) : OptGroup Add an and respective options
attr ( string $name, null | string $value = null ) : string | $this Gets or sets an attribute
optGroups ( null | array $optGroups = null ) : OptGroup[] | DropdownElement Set or get the optgroups of an Dropdown-Element.
options ( null | array $options = null ) Get or set the options of the Dropdown
val ( null | string $value = null ) Get or set the current value

보호된 메소드들

메소드 설명
getFirstOption ( ) : string Returns the first options as it will be rendered in HTML
mainElementHTML ( ) : string Create the HTML for the select it self
setValueInOptGroups ( string $value ) : boolean Set the value in the OptGroups, including the optgroup for the options without optgroup.

메소드 상세

__construct() 공개 메소드

public __construct ( string $name, array $options, string $label = '' )
$name string The name of this form element
$options array The available options
$label string The label text for this element (will be autoescaped)

addOptGroup() 공개 메소드

Add an and respective options
public addOptGroup ( string $label, array $options ) : OptGroup
$label string
$options array
리턴 OptGroup a reference to the added optgroup

attr() 공개 메소드

When no $value is given, the current content of the attribute is returned. An empty string is returned for unset attributes. When a $value is given, the content is set to that value and the Element itself is returned for easy chaining
public attr ( string $name, null | string $value = null ) : string | $this
$name string Name of the attribute to access
$value null | string New value to set
리턴 string | $this

getFirstOption() 보호된 메소드

Returns the first options as it will be rendered in HTML
protected getFirstOption ( ) : string
리턴 string

mainElementHTML() 보호된 메소드

Create the HTML for the select it self
protected mainElementHTML ( ) : string
리턴 string

optGroups() 공개 메소드

optgroups have to be given as associative array * the key being the label of the group * the value being an array of options as defined in @see OptGroup::options()
public optGroups ( null | array $optGroups = null ) : OptGroup[] | DropdownElement
$optGroups null | array
리턴 OptGroup[] | DropdownElement

options() 공개 메소드

Options can be given as associative array (value => label) or as an indexd array (label = value) or as an array of arrays. In the latter case an element has to look as follows: option-value => array ( 'label' => option-label, 'attrs' => array ( attr-key => attr-value, ... ) )
public options ( null | array $options = null )
$options null | array

setValueInOptGroups() 보호된 메소드

Set the value in the OptGroups, including the optgroup for the options without optgroup.
protected setValueInOptGroups ( string $value ) : boolean
$value string
리턴 boolean

val() 공개 메소드

When setting a value that is not defined in the options, the value is ignored and the first option's value is selected instead
public val ( null | string $value = null )
$value null | string The value to set

프로퍼티 상세

$optGroups 보호되어 있는 프로퍼티

OptGroup[]
protected $optGroups