Badge
Helper for rendering badges
- Full name:
\TwbsHelper\View\Helper\Badge - Parent class:
\TwbsHelper\View\Helper\AbstractHtmlElement
Constants
| Constant | Visibility | Type | Value |
|---|---|---|---|
TYPE_SIMPLE | public | string | 'simple' |
TYPE_PILL | public | string | 'pill' |
Properties
allowedOptions
protected static $allowedOptions
- This property is static.
Methods
__invoke
Generates a 'badge' element
public __invoke(string $content, string|array $optionsAndAttributes = [], bool $escape = true): string
Parameters:
| Parameter | Type | Description |
|---|---|---|
$content | string | The content of the badge |
$optionsAndAttributes | string|array | options and Html attributes of the "<span>" element |
$escape | bool | True espace html content '$content'. Default True |
Return Value:
The badge XHTML.
Throws:
InvalidArgumentException
prepareAttributes
protected prepareAttributes(iterable $optionsAndAttributes, string $content): \TwbsHelper\View\HtmlAttributesSet
Parameters:
| Parameter | Type | Description |
|---|---|---|
$optionsAndAttributes | iterable | |
$content | string |
prepareAttributesForVariant
protected prepareAttributesForVariant(\TwbsHelper\View\HtmlAttributesSet $optionsAndAttributes): mixed
Parameters:
| Parameter | Type | Description |
|---|---|---|
$optionsAndAttributes | \TwbsHelper\View\HtmlAttributesSet |
prepareAttributesForText
protected prepareAttributesForText(\TwbsHelper\View\HtmlAttributesSet $optionsAndAttributes): mixed
Parameters:
| Parameter | Type | Description |
|---|---|---|
$optionsAndAttributes | \TwbsHelper\View\HtmlAttributesSet |
prepareAttributesForType
protected prepareAttributesForType(\TwbsHelper\View\HtmlAttributesSet $optionsAndAttributes): mixed
Parameters:
| Parameter | Type | Description |
|---|---|---|
$optionsAndAttributes | \TwbsHelper\View\HtmlAttributesSet |
prepareAttributesForPositioned
protected prepareAttributesForPositioned(\TwbsHelper\View\HtmlAttributesSet $optionsAndAttributes, string $content): mixed
Parameters:
| Parameter | Type | Description |
|---|---|---|
$optionsAndAttributes | \TwbsHelper\View\HtmlAttributesSet | |
$content | string |
renderHiddenContent
protected renderHiddenContent(string $hiddenContent, bool $escape): string
Parameters:
| Parameter | Type | Description |
|---|---|---|
$hiddenContent | string | |
$escape | bool |