Attr
HTML attributes
- Full name:
\Qubus\Form\FormBuilder\Attr - Parent class:
ArrayIterator
Methods
__construct
Parameters:
| Parameter | Type | Description |
|---|---|---|
$array | array |
cast
Cast the value of an attribute to a string.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$value | mixed |
castClass
Cast the value of an attribute to a string.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$values | array |
set
Set HTML attribute(s).
Parameters:
| Parameter | Type | Description |
|---|---|---|
$attr | array|string | Attribute name or assoc array with attributes |
$value | mixed|null |
Return Value:
$this
get
Get an HTML attribute(s).
All attributes will be cased to their string representation.
- This method is final. Parameters:
| Parameter | Type | Description |
|---|---|---|
$attr | string|null | Attribute name, omit to get all attributes |
getRaw
Get an HTML attribute(s) without casting them.
- This method is final. Parameters:
| Parameter | Type | Description |
|---|---|---|
$attr | string|null | Attribute name, omit to get all attributes |
getAll
Get all HTML attributes.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$raw | bool | Don't cast attributes |
hasClass
Check if class is present
Parameters:
| Parameter | Type | Description |
|---|---|---|
$class | string |
addClass
Add a class
Parameters:
| Parameter | Type | Description |
|---|---|---|
$class | array|string | Multiple classes may be specified as array or using a space |
removeClass
Remove a class
Parameters:
| Parameter | Type | Description |
|---|---|---|
$class | array|string | Multiple classes may be specified as array or using a space |
Return Value:
$this
render
Get attributes as string
Parameters:
| Parameter | Type | Description |
|---|---|---|
$override | array | Attributes to add or override |
renderOnly
Get specific attributes as string
Parameters:
| Parameter | Type | Description |
|---|---|---|
$attrs | array|string |
__toString
Get attributes as string
- This method is final.
offsetGet
Get value for an offset
Parameters:
| Parameter | Type | Description |
|---|---|---|
$index | string |
offsetUnset
Unset value at offset
Parameters:
| Parameter | Type | Description |
|---|---|---|
$index | mixed |
offsetSet
Set value for an offset
Parameters:
| Parameter | Type | Description |
|---|---|---|
$index | mixed | The index to set for. |
$newval | mixed | The new value to store at the index. |
append
Append a value.
- This method is final. Parameters:
| Parameter | Type | Description |
|---|---|---|
$value | mixed |
Throws:
appendAttr
Add a key/value as HTML attribute.
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$pairs | array | |
$key | string | |
$value | mixed | Scalar |