Documentation

AbstractSelect extends AbstractElement
in package

Abstract select element class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2023 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
3.6.0

Table of Contents

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
$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
Form element hint
$hintAttributes  : array<string|int, mixed>
Form element hint attributes
$indent  : string
Indentation for formatting purposes
$label  : string
Form element label
$labelAttributes  : array<string|int, mixed>
Form element label attributes
$name  : string
Element name
$nodeName  : string
Child element node name
$nodeValue  : string
Child element node value
$output  : string
Child output
$parent  : AbstractNode
Parent node
$preserveWhiteSpace  : bool
Flag to preserve whitespace
$readonly  : bool
Form element readonly property
$required  : bool
Form element required property
$selected  : mixed
Selected value(s)
$validators  : array<string|int, mixed>
Form element validators
__construct()  : mixed
Constructor
__toString()  : string
Render Dom child object to string
addChild()  : mixed
Add a child to the object
addChildren()  : mixed
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
getAttribute()  : string
Get the attribute of the child object
getAttributes()  : array<string|int, mixed>
Get the attributes of the child object
getChild()  : Child
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
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
Get form element object label
getLabelAttributes()  : array<string|int, mixed>
Get the attributes of the form element object label
getName()  : string
Get form element object name
getNodeContent()  : string
Return the child node content, including tags, etc
getNodeName()  : string
Return the child node name
getNodeValue()  : string
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
Return the parent node
getSelected()  : mixed
Get select form element selected value (alias)
getTextContent()  : string
Return the child node content, including tags, etc
getType()  : string
Get form element object type
getValidators()  : array<string|int, mixed>
Get validators
getValue()  : mixed
Get select form element selected value
hasAttribute()  : bool
Determine if the child object has an attribute
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
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()  : mixed
Render the child and its child nodes.
resetValue()  : AbstractElement
Reset the value of the form element
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()  : Select
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()  : mixed
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
setReadonly()  : Select
Set whether the form element is readonly
setRequired()  : Select
Set whether the form element is required
setValidators()  : AbstractElement
Set validators
setValue()  : AbstractElement
Set the value of the 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

$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 = []

$hintAttributes

Form element hint attributes

protected array<string|int, mixed> $hintAttributes = []

$indent

Indentation for formatting purposes

protected string $indent = null

$labelAttributes

Form element label attributes

protected array<string|int, mixed> $labelAttributes = []

$nodeName

Child element node name

protected string $nodeName = null

$nodeValue

Child element node value

protected string $nodeValue = 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

$validators

Form element validators

protected array<string|int, mixed> $validators = []

Methods

__construct()

Constructor

public __construct(string $name[, string $value = null ][, array<string|int, mixed> $options = [] ]) : mixed

Instantiate the DOM element object

Parameters
$name : string
$value : string = null
$options : array<string|int, mixed> = []
Return values
mixed

__toString()

Render Dom child object to string

public __toString() : string
Return values
string

addChild()

Add a child to the object

public addChild(mixed $c) : mixed
Parameters
$c : mixed
Tags
throws
InvalidArgumentException
Return values
mixed

addChildren()

Add children to the object

public addChildren( $children) : mixed
Parameters
$children :
Tags
throws
Exception
Return values
mixed

addNodeValue()

Add to the child node value

public addNodeValue(string $value) : Child
Parameters
$value : string
Return values
Child

addValidators()

Add multiple validators the form element

public addValidators(array<string|int, mixed> $validators) : AbstractElement
Parameters
$validators : array<string|int, mixed>
Return values
AbstractElement

create()

Static factory method to create a child object

public static create(string $name[, string $value = null ][, array<string|int, mixed> $options = [] ]) : Child
Parameters
$name : string
$value : string = null
$options : array<string|int, mixed> = []
Return values
Child

getAttribute()

Get the attribute of the child object

public getAttribute(string $name) : string
Parameters
$name : string
Return values
string

getAttributes()

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
Parameters
$i : int
Return values
Child

getChildNodes()

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
Return values
string

getHintAttributes()

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
string

getLabel()

Get form element object label

public getLabel() : string
Return values
string

getLabelAttributes()

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
Return values
string

getNodeContent()

Return the child node content, including tags, etc

public getNodeContent([bool $ignoreWhiteSpace = false ]) : string
Parameters
$ignoreWhiteSpace : bool = false
Return values
string

getNodeName()

Return the child node name

public getNodeName() : string
Return values
string

getNodeValue()

Return the child node value

public getNodeValue() : string
Return values
string

getOptions()

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>

getSelected()

Get select form element selected value (alias)

public getSelected() : mixed
Return values
mixed

getTextContent()

Return the child node content, including tags, etc

public getTextContent([bool $ignoreWhiteSpace = false ]) : string
Parameters
$ignoreWhiteSpace : bool = false
Return values
string

getType()

Get form element object type

public getType() : string
Return values
string

getValidators()

Get validators

public getValidators() : array<string|int, mixed>
Return values
array<string|int, mixed>

getValue()

Get select form element selected value

public getValue() : mixed
Return values
mixed

hasAttribute()

Determine if the child object has an attribute

public hasAttribute(string $name) : bool
Parameters
$name : string
Return values
bool

hasChildNodes()

Get whether or not the child object has children (alias)

public hasChildNodes() : bool
Return values
bool

hasChildren()

Get whether or not the child object has children

public hasChildren() : bool
Return values
bool

hasErrors()

Get if form element object has errors

public hasErrors() : bool
Return values
bool

isButton()

Get whether the form element object is a button

public isButton() : bool
Return values
bool

isCData()

Determine if the child node value is CDATA

public isCData() : bool
Return values
bool

isChildrenFirst()

Determine if child nodes render first, before the node value

public isChildrenFirst() : bool
Return values
bool

isDisabled()

Get whether the form element object is disabled

public isDisabled() : bool
Return values
bool

isErrorPre()

Determine if error to display before the element

public isErrorPre() : bool
Return values
bool

isReadonly()

Get whether the form element object is readonly

public isReadonly() : bool
Return values
bool

isRequired()

Get whether the form element object is required

public isRequired() : bool
Return values
bool

parseFile()

Static method to parse an XML/HTML string from a file

public static parseFile(string $file) : Child
Parameters
$file : string
Tags
throws
Exception
Return values
Child

parseString()

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 $xmlFile = null ]) : array<string|int, mixed>
Parameters
$values : string|array<string|int, mixed>
$xmlFile : string = 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
Child

removeAttribute()

Remove an attribute from the child element object

public removeAttribute(string $a) : Child
Parameters
$a : string
Return values
Child

removeChild()

Remove all child nodes from the object

public removeChild(int $i) : void
Parameters
$i : int
Return values
void

removeChildren()

Remove all child nodes from the object

public removeChildren() : void
Return values
void

render()

Render the child and its child nodes.

public render(int $depth[, string $indent = null ][, bool $inner = false ]) : mixed
Parameters
$depth : int
$indent : string = null
$inner : bool = false
Return values
mixed

setAsCData()

Set the child node value as CDATA

public setAsCData([bool $cData = true ]) : Child
Parameters
$cData : bool = true
Return values
Child

setAttribute()

Set an attribute for the child element object

public setAttribute(string $a, string $v) : Child
Parameters
$a : string
$v : string
Return values
Child

setAttributes()

Set an attribute or attributes for the child element object

public setAttributes(array<string|int, mixed> $a) : Child
Parameters
$a : array<string|int, mixed>
Return values
Child

setChildrenFirst()

Set whether child nodes render first, before the node value

public setChildrenFirst([bool $first = true ]) : Child
Parameters
$first : bool = true
Return values
Child

setDisabled()

Set whether the form element is disabled

public setDisabled(bool $disabled) : Select
Parameters
$disabled : bool
Return values
Select

setHintAttributes()

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
AbstractElement

setIndent()

Set the indent

public setIndent(string $indent) : mixed
Parameters
$indent : string
Return values
mixed

setLabelAttributes()

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
AbstractElement

setNodeName()

Set the child node name

public setNodeName(string $name) : Child
Parameters
$name : string
Return values
Child

setNodeValue()

Set the child node value

public setNodeValue(string $value) : Child
Parameters
$value : string
Return values
Child

setReadonly()

Set whether the form element is readonly

public setReadonly(bool $readonly) : Select
Parameters
$readonly : bool
Return values
Select

setRequired()

Set whether the form element is required

public setRequired(bool $required) : Select
Parameters
$required : bool
Return values
Select

validate()

Validate the form element object

public validate([array<string|int, mixed> $formValues = [] ]) : bool
Parameters
$formValues : array<string|int, mixed> = []
Return values
bool

validateCallable()

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> = []
Return values
void

validateValue()

Validate the value

public validateValue(mixed $value[, array<string|int, mixed> $formValues = [] ]) : void
Parameters
$value : mixed
$formValues : array<string|int, mixed> = []
Return values
void

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
Return values
array<string|int, mixed>

Search results