Skip to main content

HtmlList

Helper for numbered and unnumbered lists


Properties

allowedOptions

protected static $allowedOptions
  • This property is static.

Methods

__invoke

Generates a 'List' element. Manage indentation of Xhtml markup

public __invoke(iterable $items, iterable $optionsAndAttributes = [], bool $escape = true): string

Parameters:

ParameterTypeDescription
$itemsiterableArray with the elements of the list
$optionsAndAttributesiterableAttributes for the ol/ul tag.
If class attributes contains "list-inline", so the li will have the class "list-inline-item"
$escapeboolEscape the items.

Return Value:

The list XHTML.

Throws:

  • InvalidArgumentException

getContainerClassesFromOptionsAndAttributes

protected getContainerClassesFromOptionsAndAttributes(iterable $optionsAndAttributes): array

Parameters:

ParameterTypeDescription
$optionsAndAttributesiterable

renderContainer

protected renderContainer(iterable $optionsAndAttributes, string $listContent, bool $escape): string

Parameters:

ParameterTypeDescription
$optionsAndAttributesiterable
$listContentstring
$escapebool

renderListItem

protected renderListItem(mixed $item, string $itemContent, iterable $optionsAndAttributes, bool $escape): string

Parameters:

ParameterTypeDescription
$itemmixed
$itemContentstring
$optionsAndAttributesiterable
$escapebool

renderNestedListItem

protected renderNestedListItem(iterable $item, string $itemContent, iterable $optionsAndAttributes, bool $escape): string

Parameters:

ParameterTypeDescription
$itemiterable
$itemContentstring
$optionsAndAttributesiterable
$escapebool

renderListItemContent

protected renderListItemContent(iterable $item, string $itemContent, bool $escape): string

Parameters:

ParameterTypeDescription
$itemiterable
$itemContentstring
$escapebool

prepareItemSpec

protected prepareItemSpec(mixed $item, iterable $optionsAndAttributes): iterable

Parameters:

ParameterTypeDescription
$itemmixed
$optionsAndAttributesiterable

getListItemClassesFromOptionsAndAttributes

protected getListItemClassesFromOptionsAndAttributes(iterable $optionsAndAttributes): array

Parameters:

ParameterTypeDescription
$optionsAndAttributesiterable