Skip to main content

HtmlElement


  • Full name: \TwbsHelper\View\Helper\HtmlElement
  • Parent class: AbstractHtmlElement

Properties​

htmlElementFormat​

protected $htmlElementFormat

indentation​

protected $indentation

forcedIndentationTags​

protected $forcedIndentationTags

Methods​

__invoke​

Generates an 'html' element

public __invoke(string $tag, iterable $attributes = [], string $content = null, bool $escape = true): string

Parameters:

ParameterTypeDescription
$tagstringThe tag of the element
$attributesiterableHtml attributes of the element
$contentstringThe content of the alert
$escapeboolTrue espace html content '$content'. Default True

Return Value:

The element XHTML.


addProperIndentation​

public addProperIndentation(string $content, bool $forceIndentation = false, ?int $indentation = null): string

Parameters:

ParameterTypeDescription
$contentstring
$forceIndentationbool
$indentation?int

removeIndentation​

protected removeIndentation(string $content): string

Parameters:

ParameterTypeDescription
$contentstring

isHTML​

public isHTML(string $string): bool

Parameters:

ParameterTypeDescription
$stringstring

htmlAttribs​

Converts an associative array to a string of tag attributes.

protected htmlAttribs(array $attribs): string

Parameters:

ParameterTypeDescription
$attribsarrayFrom this array, each key-value pair is
converted to an attribute name and value.

Return Value:

The XHTML for the attributes.