Craft Themes (3.x)

ClassBag
in package

Defines a list of classes for a html element.

Table of Contents

$classes  : array<string|int, mixed>
__construct()  : mixed
__toString()  : mixed
add()  : ClassBag
Add a class or several classes
get()  : array<string|int, mixed>
Get all classes
has()  : bool
Is a class in the list
remove()  : ClassBag
Removes a class from the list
size()  : int
Get amount of classes
toHtml()  : string
Get classes html

Properties

$classes

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

Methods

__construct()

public __construct([array<string|int, mixed> $classes = [] ]) : mixed
Parameters
$classes : array<string|int, mixed> = []
Tags
inheritDoc
Return values
mixed

__toString()

public __toString() : mixed
Tags
inheritDoc
Return values
mixed

add()

Add a class or several classes

public add(string|array<string|int, mixed> $class) : ClassBag
Parameters
$class : string|array<string|int, mixed>
Return values
ClassBag

get()

Get all classes

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

has()

Is a class in the list

public has(string $class) : bool
Parameters
$class : string
Return values
bool

remove()

Removes a class from the list

public remove(string $class) : ClassBag
Parameters
$class : string
Return values
ClassBag

size()

Get amount of classes

public size() : int
Return values
int

toHtml()

Get classes html

public toHtml() : string
Return values
string

Search results