HtmlBuilder
class HtmlBuilder
Traits
Properties
static protected array | $components | The registered components. |
from Componentable |
protected UrlGenerator | $url | The URL generator instance. |
|
protected Factory | $view | The View Factory instance. |
Methods
Register a custom component.
Prepare the component data, while respecting provided defaults.
Dynamically handle calls to the class.
Create a new HTML builder instance.
Convert an HTML string to entities.
Convert entities to HTML characters.
Generate a link to a JavaScript file.
Generate a link to a CSS file.
Generate an HTML image element.
Generate a link to a Favicon file.
Generate a HTML link.
Generate a HTTPS HTML link.
Generate a HTML link to an asset.
Generate a HTTPS HTML link to an asset.
Generate a HTML link to a named route.
Generate a HTML link to a controller action.
Generate a HTML link to an email address.
Obfuscate an e-mail address to prevent spam-bots from sniffing it.
Generates non-breaking space entities based on number supplied.
Generate an ordered list of items.
Generate an un-ordered list of items.
Generate a description list of items.
Create a listing HTML element.
Create the HTML for a listing element.
Create the HTML for a nested listing attribute.
Build an HTML attribute string from an array.
Build a single attribute element.
Obfuscate a string to prevent spam-bots from sniffing it.
Generate a meta tag.
Generate an html tag.
Transform the string to an Html serializable object
Details
in
Componentable at line 26
static void
component($name, $view, array $signature)
Register a custom component.
in
Componentable at line 38
static bool
hasComponent($name)
Check if a component is registered.
in
Componentable at line 51
protected HtmlString
renderComponent($name, array $arguments)
Render a custom component.
in
Componentable at line 69
protected array
getComponentData(array $signature, array $arguments)
Prepare the component data, while respecting provided defaults.
at line 557
View|mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 38
__construct(UrlGenerator $url = null, Factory $view)
Create a new HTML builder instance.
at line 51
string
entities(string $value)
Convert an HTML string to entities.
at line 63
string
decode(string $value)
Convert entities to HTML characters.
at line 77
HtmlString
script(string $url, array $attributes = [], bool $secure = null)
Generate a link to a JavaScript file.
at line 93
HtmlString
style(string $url, array $attributes = [], bool $secure = null)
Generate a link to a CSS file.
at line 114
HtmlString
image(string $url, string $alt = null, array $attributes = [], bool $secure = null)
Generate an HTML image element.
at line 131
HtmlString
favicon(string $url, array $attributes = [], bool $secure = null)
Generate a link to a Favicon file.
at line 153
HtmlString
link(string $url, string $title = null, array $attributes = [], bool $secure = null, bool $escape = true)
Generate a HTML link.
at line 177
HtmlString
secureLink(string $url, string $title = null, array $attributes = [])
Generate a HTTPS HTML link.
at line 192
HtmlString
linkAsset(string $url, string $title = null, array $attributes = [], bool $secure = null)
Generate a HTML link to an asset.
at line 208
HtmlString
linkSecureAsset(string $url, string $title = null, array $attributes = [])
Generate a HTTPS HTML link to an asset.
at line 223
HtmlString
linkRoute(string $name, string $title = null, array $parameters = [], array $attributes = [])
Generate a HTML link to a named route.
at line 238
HtmlString
linkAction(string $action, string $title = null, array $parameters = [], array $attributes = [])
Generate a HTML link to a controller action.
at line 253
HtmlString
mailto(string $email, string $title = null, array $attributes = [], bool $escape = true)
Generate a HTML link to an email address.
at line 275
string
email(string $email)
Obfuscate an e-mail address to prevent spam-bots from sniffing it.
at line 287
string
nbsp(int $num = 1)
Generates non-breaking space entities based on number supplied.
at line 300
HtmlString|string
ol(array $list, array $attributes = [])
Generate an ordered list of items.
at line 313
HtmlString|string
ul(array $list, array $attributes = [])
Generate an un-ordered list of items.
at line 326
HtmlString
dl(array $list, array $attributes = [])
Generate a description list of items.
at line 356
protected HtmlString|string
listing(string $type, array $list, array $attributes = [])
Create a listing HTML element.
at line 385
protected string
listingElement(mixed $key, string $type, mixed $value)
Create the HTML for a listing element.
at line 404
protected string
nestedListing(mixed $key, string $type, mixed $value)
Create the HTML for a nested listing attribute.
at line 421
string
attributes(array $attributes)
Build an HTML attribute string from an array.
at line 444
protected string
attributeElement(string $key, string $value)
Build a single attribute element.
at line 472
string
obfuscate(string $value)
Obfuscate a string to prevent spam-bots from sniffing it.
at line 510
HtmlString
meta(string $name, string $content, array $attributes = [])
Generate a meta tag.
at line 528
HtmlString
tag(string $tag, mixed $content, array $attributes = [])
Generate an html tag.
at line 542
protected HtmlString
toHtmlString($html)
Transform the string to an Html serializable object