ClassTrait
A trait that provides useful methods to generate bootstrap html specific code.
Table of Contents
Methods
- addClass() : array<string|int, mixed>
- Adds the given class to the element options.
- _addButtonClasses() : array<string|int, mixed>
- Add classes to options according to the default values of bootstrap-type and bootstrap-size for button (see configuration).
- _isAssociativeArray() : bool
- Check weither the specified array is associative or not.
Methods
addClass()
Adds the given class to the element options.
public
addClass([array<string|int, mixed> $options = [] ][, string|array<string|int, mixed> $class = null ][, string $key = "class" ]) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed> = []
-
Array of options/attributes to add a class to.
- $class : string|array<string|int, mixed> = null
-
The class names to be added.
- $key : string = "class"
-
The key to use for class (default to
'class').
Return values
array<string|int, mixed> —Array of options with $key set or modified.
_addButtonClasses()
Add classes to options according to the default values of bootstrap-type and bootstrap-size for button (see configuration).
protected
_addButtonClasses(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
-
The initial options with btype and/or size, block values.
Return values
array<string|int, mixed> —The new options with class values (btn, and btn-* according to initial options).
_isAssociativeArray()
Check weither the specified array is associative or not.
protected
_isAssociativeArray(array<string|int, mixed> $array) : bool
Parameters
- $array : array<string|int, mixed>
-
The array to check.
Return values
bool —true if the array is associative, false otherwize.