Select
extends AbstractSelect
in package
Form select element class
Tags
Table of Contents
Constants
- DAYS_OF_MONTH = 'DAYS_OF_MONTH'
- Constant for days of the month
- HOURS_12 = 'HOURS_12'
- Constant for 12 hours
- HOURS_24 = 'HOURS_24'
- Constant for 24 hours
- MINUTES = 'MINUTES'
- Constant for 60 minutes (0-59)
- MINUTES_10 = 'MINUTES_10'
- Constant for minutes in increments of 10
- MINUTES_15 = 'MINUTES_15'
- Constant for minutes in increments of 15
- MINUTES_5 = 'MINUTES_5'
- Constant for minutes in increments of 5
- MONTHS_SHORT = 'MONTHS_SHORT'
- Constant for months, short
Properties
- $append : string|null
- Form element append contents
- $attributes : array<string|int, mixed>
- Child element attributes
- $cData : bool
- Child element node value CDATA flag
- $childNodes : array<string|int, mixed>
- Object child nodes
- $childrenFirst : bool
- Flag to render children before node value or not
- $disabled : bool
- Form element disabled property
- $errorPre : bool
- Form element error display position
- $errors : array<string|int, mixed>
- Form element errors
- $hint : string|null
- Form element hint
- $hintAttributes : array<string|int, mixed>
- Form element hint attributes
- $indent : string|null
- Indentation for formatting purposes
- $label : string|null
- Form element label
- $labelAttributes : array<string|int, mixed>
- Form element label attributes
- $name : string|null
- Element name
- $nodeName : string|null
- Child element node name
- $nodeValue : string|null
- Child element node value
- $output : string|null
- Child output
- $parent : AbstractNode|null
- Parent node
- $prepend : string|null
- Form element prepend contents
- $preserveWhiteSpace : bool
- Flag to preserve whitespace
- $readonly : bool
- Form element readonly property
- $required : bool
- Form element required property
- $requiredMessage : string|null
- Form element required message
- $selected : mixed
- Selected value(s)
- $validators : array<string|int, mixed>
- Form element validators
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Render Dom child object to string
- addChild() : AbstractNode
- Add a child to the object
- addChildren() : AbstractNode
- Add children to the object
- addNodeValue() : Child
- Add to the child node value
- addValidator() : AbstractElement
- Add a validator the form element
- addValidators() : AbstractElement
- Add multiple validators the form element
- clearErrors() : AbstractElement
- Clear errors
- create() : Child
- Static factory method to create a child object
- getAppend() : string|null
- Get form element object append contents
- getAttribute() : string|null
- Get the attribute of the child object
- getAttributes() : array<string|int, mixed>
- Get the attributes of the child object
- getChild() : Child|null
- Get the child nodes of the object
- getChildNodes() : array<string|int, mixed>
- Get the child nodes of the object (alias)
- getChildren() : array<string|int, mixed>
- Get the child nodes of the object
- getErrors() : array<string|int, mixed>
- Get form element object errors
- getHint() : string|null
- Get form element object hint
- getHintAttributes() : array<string|int, mixed>
- Get the attributes of the form element object hint
- getIndent() : string
- Return the indent
- getLabel() : string|null
- Get form element object label
- getLabelAttributes() : array<string|int, mixed>
- Get the attributes of the form element object label
- getName() : string|null
- Get form element object name
- getNodeContent() : string
- Return the child node content, including tags, etc
- getNodeName() : string|null
- Return the child node name
- getNodeValue() : string|null
- Return the child node value
- getOptions() : array<string|int, mixed>
- Get select options
- getOptionsAsArray() : array<string|int, mixed>
- Get select options as array
- getParent() : AbstractNode|null
- Return the parent node
- getPrepend() : string|null
- Get form element object prepend contents
- getRequiredMessage() : string|null
- Get the form element object required message
- getSelected() : mixed
- Get select form element selected value (alias)
- getTextContent() : string
- Return the child node content, including tags, etc
- getType() : string|null
- Get form element object type
- getValidators() : array<string|int, mixed>
- Get validators
- getValue() : mixed
- Get form element value
- hasAppend() : bool
- Determine if form element has append content
- hasAttribute() : bool
- Determine if the child object has an attribute
- hasAttributes() : bool
- Determine if the child object has attributes
- hasChildNodes() : bool
- Get whether or not the child object has children (alias)
- hasChildren() : bool
- Get whether or not the child object has children
- hasErrors() : bool
- Get if form element object has errors
- hasHint() : bool
- Determine if form element has a hint
- hasHintAttributes() : bool
- Determine if form element has hint attributes
- hasLabel() : bool
- Determine if form element has a label
- hasLabelAttributes() : bool
- Determine if form element has label attributes
- hasPrepend() : bool
- Determine if form element has prepend content
- hasRequiredMessage() : bool
- Does the form element object have a required message
- hasValidators() : bool
- Determine if form element has validators
- isButton() : bool
- Get whether the form element object is a button
- isCData() : bool
- Determine if the child node value is CDATA
- isChildrenFirst() : bool
- Determine if child nodes render first, before the node value
- isDisabled() : bool
- Get whether the form element object is disabled
- isErrorPre() : bool
- Determine if error to display before the element
- isReadonly() : bool
- Get whether the form element object is readonly
- isRequired() : bool
- Get whether the form element object is required
- parseFile() : Child
- Static method to parse an XML/HTML string from a file
- parseString() : Child|array<string|int, mixed>
- Static method to parse an XML/HTML string
- parseValues() : array<string|int, mixed>
- Set the select element as multiple
- preserveWhiteSpace() : Child
- Set whether to preserve whitespace
- removeAttribute() : Child
- Remove an attribute from the child element object
- removeChild() : void
- Remove all child nodes from the object
- removeChildren() : void
- Remove all child nodes from the object
- render() : string|null
- Render the child and its child nodes.
- resetValue() : Select
- Reset the value of the form element
- setAppend() : AbstractElement
- Set the append contents of the form element object
- setAsCData() : Child
- Set the child node value as CDATA
- setAttribute() : Child
- Set an attribute for the child element object
- setAttributes() : Child
- Set an attribute or attributes for the child element object
- setChildrenFirst() : Child
- Set whether child nodes render first, before the node value
- setDisabled() : AbstractElement
- Set whether the form element is disabled
- setErrorPre() : AbstractElement
- Set error pre-display
- setHint() : AbstractElement
- Set the hint of the form element object
- setHintAttribute() : AbstractElement
- Set an attribute of the hint of the form element object
- setHintAttributes() : AbstractElement
- Set the attributes of the hint of the form element object
- setIndent() : AbstractNode
- Set the indent
- setLabel() : AbstractElement
- Set the label of the form element object
- setLabelAttribute() : AbstractElement
- Set an attribute of the label of the form element object
- setLabelAttributes() : AbstractElement
- Set the attributes of the label of the form element object
- setName() : AbstractElement
- Set the name of the form element object
- setNodeName() : Child
- Set the child node name
- setNodeValue() : Child
- Set the child node value
- setParent() : AbstractNode
- Set the parent node
- setPrepend() : AbstractElement
- Set the prepend contents of the form element object
- setReadonly() : AbstractElement
- Set whether the form element is readonly
- setRequired() : AbstractElement
- Set whether the form element is required
- setRequiredMessage() : AbstractElement
- Set the form element is required message
- setValidators() : AbstractElement
- Set validators
- setValue() : Select
- Set the selected value of the select form element
- setValues() : Select
- Set the options values of the select form element
- validate() : bool
- Validate the form element object
- validateCallable() : void
- Validate the value by callable
- validateValue() : void
- Validate the value
- parseXml() : array<string|int, mixed>
- Static method to parse an XML file of options
Constants
DAYS_OF_MONTH
Constant for days of the month
public
string
DAYS_OF_MONTH
= 'DAYS_OF_MONTH'
HOURS_12
Constant for 12 hours
public
string
HOURS_12
= 'HOURS_12'
HOURS_24
Constant for 24 hours
public
string
HOURS_24
= 'HOURS_24'
MINUTES
Constant for 60 minutes (0-59)
public
string
MINUTES
= 'MINUTES'
MINUTES_10
Constant for minutes in increments of 10
public
string
MINUTES_10
= 'MINUTES_10'
MINUTES_15
Constant for minutes in increments of 15
public
string
MINUTES_15
= 'MINUTES_15'
MINUTES_5
Constant for minutes in increments of 5
public
string
MINUTES_5
= 'MINUTES_5'
MONTHS_SHORT
Constant for months, short
public
string
MONTHS_SHORT
= 'MONTHS_SHORT'
Properties
$append
Form element append contents
protected
string|null
$append
= null
$attributes
Child element attributes
protected
array<string|int, mixed>
$attributes
= []
$cData
Child element node value CDATA flag
protected
bool
$cData
= false
$childNodes
Object child nodes
protected
array<string|int, mixed>
$childNodes
= []
$childrenFirst
Flag to render children before node value or not
protected
bool
$childrenFirst
= false
$disabled
Form element disabled property
protected
bool
$disabled
= false
$errorPre
Form element error display position
protected
bool
$errorPre
= false
$errors
Form element errors
protected
array<string|int, mixed>
$errors
= []
$hint
Form element hint
protected
string|null
$hint
= null
$hintAttributes
Form element hint attributes
protected
array<string|int, mixed>
$hintAttributes
= []
$indent
Indentation for formatting purposes
protected
string|null
$indent
= null
$label
Form element label
protected
string|null
$label
= null
$labelAttributes
Form element label attributes
protected
array<string|int, mixed>
$labelAttributes
= []
$name
Element name
protected
string|null
$name
= null
$nodeName
Child element node name
protected
string|null
$nodeName
= null
$nodeValue
Child element node value
protected
string|null
$nodeValue
= null
$output
Child output
protected
string|null
$output
= null
$parent
Parent node
protected
AbstractNode|null
$parent
= null
$prepend
Form element prepend contents
protected
string|null
$prepend
= null
$preserveWhiteSpace
Flag to preserve whitespace
protected
bool
$preserveWhiteSpace
= true
$readonly
Form element readonly property
protected
bool
$readonly
= false
$required
Form element required property
protected
bool
$required
= false
$requiredMessage
Form element required message
protected
string|null
$requiredMessage
= null
$selected
Selected value(s)
protected
mixed
$selected
= null
$validators
Form element validators
protected
array<string|int, mixed>
$validators
= []
Methods
__construct()
Constructor
public
__construct(string $name, string|array<string|int, mixed> $values[, mixed $selected = null ][, string|null $xmlFile = null ][, string|null $indent = null ]) : mixed
Instantiate the select form element object
Parameters
- $name : string
- $values : string|array<string|int, mixed>
- $selected : mixed = null
- $xmlFile : string|null = null
- $indent : string|null = null
__toString()
Render Dom child object to string
public
__toString() : string
Return values
stringaddChild()
Add a child to the object
public
addChild(Child $c) : AbstractNode
Parameters
- $c : Child
Tags
Return values
AbstractNodeaddChildren()
Add children to the object
public
addChildren(mixed $children) : AbstractNode
Parameters
- $children : mixed
Tags
Return values
AbstractNodeaddNodeValue()
Add to the child node value
public
addNodeValue(string $value) : Child
Parameters
- $value : string
Return values
ChildaddValidator()
Add a validator the form element
public
addValidator(mixed $validator) : AbstractElement
Parameters
- $validator : mixed
Tags
Return values
AbstractElementaddValidators()
Add multiple validators the form element
public
addValidators(array<string|int, mixed> $validators) : AbstractElement
Parameters
- $validators : array<string|int, mixed>
Tags
Return values
AbstractElementclearErrors()
Clear errors
public
clearErrors() : AbstractElement
Return values
AbstractElementcreate()
Static factory method to create a child object
public
static create(string $name[, string|null $value = null ][, array<string|int, mixed> $options = [] ]) : Child
Parameters
- $name : string
- $value : string|null = null
- $options : array<string|int, mixed> = []
Return values
ChildgetAppend()
Get form element object append contents
public
getAppend() : string|null
Return values
string|nullgetAttribute()
Get the attribute of the child object
public
getAttribute(string $name) : string|null
Parameters
- $name : string
Return values
string|nullgetAttributes()
Get the attributes of the child object
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getChild()
Get the child nodes of the object
public
getChild(int $i) : Child|null
Parameters
- $i : int
Return values
Child|nullgetChildNodes()
Get the child nodes of the object (alias)
public
getChildNodes() : array<string|int, mixed>
Return values
array<string|int, mixed>getChildren()
Get the child nodes of the object
public
getChildren() : array<string|int, mixed>
Return values
array<string|int, mixed>getErrors()
Get form element object errors
public
getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed>getHint()
Get form element object hint
public
getHint() : string|null
Return values
string|nullgetHintAttributes()
Get the attributes of the form element object hint
public
getHintAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getIndent()
Return the indent
public
getIndent() : string
Return values
stringgetLabel()
Get form element object label
public
getLabel() : string|null
Return values
string|nullgetLabelAttributes()
Get the attributes of the form element object label
public
getLabelAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getName()
Get form element object name
public
getName() : string|null
Return values
string|nullgetNodeContent()
Return the child node content, including tags, etc
public
getNodeContent([bool $ignoreWhiteSpace = false ]) : string
Parameters
- $ignoreWhiteSpace : bool = false
Return values
stringgetNodeName()
Return the child node name
public
getNodeName() : string|null
Return values
string|nullgetNodeValue()
Return the child node value
public
getNodeValue() : string|null
Return values
string|nullgetOptions()
Get select options
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getOptionsAsArray()
Get select options as array
public
getOptionsAsArray() : array<string|int, mixed>
Return values
array<string|int, mixed>getParent()
Return the parent node
public
getParent() : AbstractNode|null
Return values
AbstractNode|nullgetPrepend()
Get form element object prepend contents
public
getPrepend() : string|null
Return values
string|nullgetRequiredMessage()
Get the form element object required message
public
getRequiredMessage() : string|null
Return values
string|nullgetSelected()
Get select form element selected value (alias)
public
getSelected() : mixed
getTextContent()
Return the child node content, including tags, etc
public
getTextContent([bool $ignoreWhiteSpace = false ]) : string
Parameters
- $ignoreWhiteSpace : bool = false
Return values
stringgetType()
Get form element object type
public
abstract getType() : string|null
Return values
string|nullgetValidators()
Get validators
public
getValidators() : array<string|int, mixed>
Return values
array<string|int, mixed>getValue()
Get form element value
public
abstract getValue() : mixed
hasAppend()
Determine if form element has append content
public
hasAppend() : bool
Return values
boolhasAttribute()
Determine if the child object has an attribute
public
hasAttribute(string $name) : bool
Parameters
- $name : string
Return values
boolhasAttributes()
Determine if the child object has attributes
public
hasAttributes() : bool
Return values
boolhasChildNodes()
Get whether or not the child object has children (alias)
public
hasChildNodes() : bool
Return values
boolhasChildren()
Get whether or not the child object has children
public
hasChildren() : bool
Return values
boolhasErrors()
Get if form element object has errors
public
hasErrors() : bool
Return values
boolhasHint()
Determine if form element has a hint
public
hasHint() : bool
Return values
boolhasHintAttributes()
Determine if form element has hint attributes
public
hasHintAttributes() : bool
Return values
boolhasLabel()
Determine if form element has a label
public
hasLabel() : bool
Return values
boolhasLabelAttributes()
Determine if form element has label attributes
public
hasLabelAttributes() : bool
Return values
boolhasPrepend()
Determine if form element has prepend content
public
hasPrepend() : bool
Return values
boolhasRequiredMessage()
Does the form element object have a required message
public
hasRequiredMessage() : bool
Return values
boolhasValidators()
Determine if form element has validators
public
hasValidators() : bool
Return values
boolisButton()
Get whether the form element object is a button
public
isButton() : bool
Return values
boolisCData()
Determine if the child node value is CDATA
public
isCData() : bool
Return values
boolisChildrenFirst()
Determine if child nodes render first, before the node value
public
isChildrenFirst() : bool
Return values
boolisDisabled()
Get whether the form element object is disabled
public
isDisabled() : bool
Return values
boolisErrorPre()
Determine if error to display before the element
public
isErrorPre() : bool
Return values
boolisReadonly()
Get whether the form element object is readonly
public
isReadonly() : bool
Return values
boolisRequired()
Get whether the form element object is required
public
isRequired() : bool
Return values
boolparseFile()
Static method to parse an XML/HTML string from a file
public
static parseFile(string $file) : Child
Parameters
- $file : string
Tags
Return values
ChildparseString()
Static method to parse an XML/HTML string
public
static parseString(string $string) : Child|array<string|int, mixed>
Parameters
- $string : string
Return values
Child|array<string|int, mixed>parseValues()
Set the select element as multiple
public
static parseValues(string|array<string|int, mixed> $values[, string|null $xmlFile = null ]) : array<string|int, mixed>
Parameters
- $values : string|array<string|int, mixed>
- $xmlFile : string|null = null
Return values
array<string|int, mixed>preserveWhiteSpace()
Set whether to preserve whitespace
public
preserveWhiteSpace([bool $preserve = true ]) : Child
Parameters
- $preserve : bool = true
Return values
ChildremoveAttribute()
Remove an attribute from the child element object
public
removeAttribute(string $name) : Child
Parameters
- $name : string
Return values
ChildremoveChild()
Remove all child nodes from the object
public
removeChild(int $i) : void
Parameters
- $i : int
removeChildren()
Remove all child nodes from the object
public
removeChildren() : void
render()
Render the child and its child nodes.
public
render([int $depth = 0 ][, string|null $indent = null ][, bool $inner = false ]) : string|null
Parameters
- $depth : int = 0
- $indent : string|null = null
- $inner : bool = false
Return values
string|nullresetValue()
Reset the value of the form element
public
resetValue() : Select
Return values
SelectsetAppend()
Set the append contents of the form element object
public
setAppend(string $append) : AbstractElement
Parameters
- $append : string
Return values
AbstractElementsetAsCData()
Set the child node value as CDATA
public
setAsCData([bool $cData = true ]) : Child
Parameters
- $cData : bool = true
Return values
ChildsetAttribute()
Set an attribute for the child element object
public
setAttribute(string $name[, mixed $value = null ]) : Child
Parameters
- $name : string
- $value : mixed = null
Return values
ChildsetAttributes()
Set an attribute or attributes for the child element object
public
setAttributes(array<string|int, mixed> $attributes) : Child
Parameters
- $attributes : array<string|int, mixed>
Return values
ChildsetChildrenFirst()
Set whether child nodes render first, before the node value
public
setChildrenFirst([bool $first = true ]) : Child
Parameters
- $first : bool = true
Return values
ChildsetDisabled()
Set whether the form element is disabled
public
setDisabled(bool $disabled) : AbstractElement
Parameters
- $disabled : bool
Return values
AbstractElementsetErrorPre()
Set error pre-display
public
setErrorPre(bool $pre) : AbstractElement
Parameters
- $pre : bool
Return values
AbstractElementsetHint()
Set the hint of the form element object
public
setHint(string $hint) : AbstractElement
Parameters
- $hint : string
Return values
AbstractElementsetHintAttribute()
Set an attribute of the hint of the form element object
public
setHintAttribute(string $a, string $v) : AbstractElement
Parameters
- $a : string
- $v : string
Return values
AbstractElementsetHintAttributes()
Set the attributes of the hint of the form element object
public
setHintAttributes(array<string|int, mixed> $attribs) : AbstractElement
Parameters
- $attribs : array<string|int, mixed>
Return values
AbstractElementsetIndent()
Set the indent
public
setIndent(string $indent) : AbstractNode
Parameters
- $indent : string
Return values
AbstractNodesetLabel()
Set the label of the form element object
public
setLabel(string $label) : AbstractElement
Parameters
- $label : string
Return values
AbstractElementsetLabelAttribute()
Set an attribute of the label of the form element object
public
setLabelAttribute(string $a, string $v) : AbstractElement
Parameters
- $a : string
- $v : string
Return values
AbstractElementsetLabelAttributes()
Set the attributes of the label of the form element object
public
setLabelAttributes(array<string|int, mixed> $attribs) : AbstractElement
Parameters
- $attribs : array<string|int, mixed>
Return values
AbstractElementsetName()
Set the name of the form element object
public
setName(string $name) : AbstractElement
Parameters
- $name : string
Return values
AbstractElementsetNodeName()
Set the child node name
public
setNodeName(string $name) : Child
Parameters
- $name : string
Return values
ChildsetNodeValue()
Set the child node value
public
setNodeValue(string $value) : Child
Parameters
- $value : string
Return values
ChildsetParent()
Set the parent node
public
setParent(AbstractNode $parent) : AbstractNode
Parameters
- $parent : AbstractNode
Return values
AbstractNodesetPrepend()
Set the prepend contents of the form element object
public
setPrepend(string $prepend) : AbstractElement
Parameters
- $prepend : string
Return values
AbstractElementsetReadonly()
Set whether the form element is readonly
public
setReadonly(bool $readonly) : AbstractElement
Parameters
- $readonly : bool
Return values
AbstractElementsetRequired()
Set whether the form element is required
public
setRequired(bool $required[, string|null $requiredMessage = 'This field is required.' ]) : AbstractElement
Parameters
- $required : bool
- $requiredMessage : string|null = 'This field is required.'
Return values
AbstractElementsetRequiredMessage()
Set the form element is required message
public
setRequiredMessage(string $requiredMessage) : AbstractElement
Parameters
- $requiredMessage : string
Return values
AbstractElementsetValidators()
Set validators
public
setValidators([array<string|int, mixed> $validators = [] ]) : AbstractElement
Parameters
- $validators : array<string|int, mixed> = []
Return values
AbstractElementsetValue()
Set the selected value of the select form element
public
setValue(mixed $value) : Select
Parameters
- $value : mixed
Return values
SelectsetValues()
Set the options values of the select form element
public
setValues(string|array<string|int, mixed> $values[, string|null $xmlFile = null ][, string|null $indent = null ]) : Select
Parameters
- $values : string|array<string|int, mixed>
- $xmlFile : string|null = null
- $indent : string|null = null
Return values
Selectvalidate()
Validate the form element object
public
abstract validate([array<string|int, mixed> $formValues = [] ]) : bool
Parameters
- $formValues : array<string|int, mixed> = []
Return values
boolvalidateCallable()
Validate the value by callable
public
validateCallable(callable $validator, mixed $value[, array<string|int, mixed> $formValues = [] ]) : void
Parameters
- $validator : callable
- $value : mixed
- $formValues : array<string|int, mixed> = []
validateValue()
Validate the value
public
validateValue(mixed $value[, array<string|int, mixed> $formValues = [] ]) : void
Parameters
- $value : mixed
- $formValues : array<string|int, mixed> = []
parseXml()
Static method to parse an XML file of options
protected
static parseXml(string $xmlFile, string $name) : array<string|int, mixed>
Parameters
- $xmlFile : string
- $name : string