Contao Utils Bundle

HtmlUtil
in package

Table of Contents

Methods

generateAttributeString()  : string
Generate a attribute string for html elements out of an array.
generateDataAttributesString()  : string
Generates a data-attributes string out of an array.

Methods

generateAttributeString()

Generate a attribute string for html elements out of an array.

public generateAttributeString(array<string|int, mixed> $attributes[, array{xhtml?: bool} $options = [] ]) : string

Options:

  • xhtml: (bool) XHTML format instead of HTML5 format. Default false
Parameters
$attributes : array<string|int, mixed>
$options : array{xhtml?: bool} = []
Return values
string

generateDataAttributesString()

Generates a data-attributes string out of an array.

public generateDataAttributesString(array<string|int, mixed> $attributes[, GenerateDataAttributesStringOptions $options = new GenerateDataAttributesStringOptions() ]) : string

Options (additional to Options from HtmlUtl::generateAttributeString()):

  • normalizeKeys: Array keys are normalized to lowercase dash-cased strings (e.g. Foo Bar_player is transformed to foo-bar-player)
Parameters
$attributes : array<string|int, mixed>
$options : GenerateDataAttributesStringOptions = new GenerateDataAttributesStringOptions()
Return values
string

        
On this page

Search results