Skip to main content

Badge

Helper for rendering badges


Constants

ConstantVisibilityTypeValue
TYPE_SIMPLEpublicstring'simple'
TYPE_PILLpublicstring'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:

ParameterTypeDescription
$contentstringThe content of the badge
$optionsAndAttributesstring|arrayoptions and Html attributes of the "<span>" element
$escapeboolTrue espace html content '$content'. Default True

Return Value:

The badge XHTML.

Throws:

  • InvalidArgumentException

prepareAttributes

protected prepareAttributes(iterable $optionsAndAttributes, string $content): \TwbsHelper\View\HtmlAttributesSet

Parameters:

ParameterTypeDescription
$optionsAndAttributesiterable
$contentstring

prepareAttributesForVariant

protected prepareAttributesForVariant(\TwbsHelper\View\HtmlAttributesSet $optionsAndAttributes): mixed

Parameters:

ParameterTypeDescription
$optionsAndAttributes\TwbsHelper\View\HtmlAttributesSet

prepareAttributesForText

protected prepareAttributesForText(\TwbsHelper\View\HtmlAttributesSet $optionsAndAttributes): mixed

Parameters:

ParameterTypeDescription
$optionsAndAttributes\TwbsHelper\View\HtmlAttributesSet

prepareAttributesForType

protected prepareAttributesForType(\TwbsHelper\View\HtmlAttributesSet $optionsAndAttributes): mixed

Parameters:

ParameterTypeDescription
$optionsAndAttributes\TwbsHelper\View\HtmlAttributesSet

prepareAttributesForPositioned

protected prepareAttributesForPositioned(\TwbsHelper\View\HtmlAttributesSet $optionsAndAttributes, string $content): mixed

Parameters:

ParameterTypeDescription
$optionsAndAttributes\TwbsHelper\View\HtmlAttributesSet
$contentstring

renderHiddenContent

protected renderHiddenContent(string $hiddenContent, bool $escape): string

Parameters:

ParameterTypeDescription
$hiddenContentstring
$escapebool