PHP Trait BootstrapUI\View\Helper\OptionsAwareTrait

Show file Open project: friendsofcake/bootstrap-ui Trait Usage Examples

Public Properties

Property Type Description
$buttonClassAliases array A mapping of aliases for button styles.
$buttonClasses array A list of allowed styles for buttons.

Public Methods

Method Description
applyButtonClasses ( array $data ) : array Contains the logic for applying style classes for buttons.
checkClasses ( array | string $classes, array $options ) : boolean Checks if $classes are part of the $options['class'].
hasAnyClass ( array | string $classes, array $options ) : boolean Checks if $options['class'] contains any one of the class names.
injectClasses ( array | string $classes, array $options ) : array Injects classes into $options['class'] when they don't already exist. If a class is defined in $options['skip'] then it will not be injected. This method removes $options['skip'] before returning.
renameClasses ( array $classMap, array $options ) : array Renames any CSS classes found in the options.

Protected Methods

Method Description
_toClassArray ( mixed $mixed ) : array Normalizes class strings/arrays.

Method Details

_toClassArray() protected method

Normalizes class strings/arrays.
protected _toClassArray ( mixed $mixed ) : array
$mixed mixed One or more classes.
return array Classes as array.

applyButtonClasses() public method

Contains the logic for applying style classes for buttons.
public applyButtonClasses ( array $data ) : array
$data array An array of HTML attributes and options.
return array An array of HTML attributes and options.

checkClasses() public method

Checks if $classes are part of the $options['class'].
public checkClasses ( array | string $classes, array $options ) : boolean
$classes array | string Name of class(es) to check.
$options array An array of HTML attributes and options.
return boolean False if one or more class(es) do not exist.

hasAnyClass() public method

Checks if $options['class'] contains any one of the class names.
public hasAnyClass ( array | string $classes, array $options ) : boolean
$classes array | string Name of class(es) to check.
$options array An array of HTML attributes and options.
return boolean True if any one of the class names was found.

injectClasses() public method

Injects classes into $options['class'] when they don't already exist. If a class is defined in $options['skip'] then it will not be injected. This method removes $options['skip'] before returning.
public injectClasses ( array | string $classes, array $options ) : array
$classes array | string Name of class(es) to inject.
$options array An array of HTML attributes and options.
return array An array of HTML attributes and options.

renameClasses() public method

Renames any CSS classes found in the options.
public renameClasses ( array $classMap, array $options ) : array
$classMap array Key/Value pair of class(es) to be renamed.
$options array An array of HTML attributes and options.
return array An array of HTML attributes and options.

Property Details

$buttonClassAliases public property

A mapping of aliases for button styles.
public array $buttonClassAliases
return array

$buttonClasses public property

A list of allowed styles for buttons.
public array $buttonClasses
return array