class HtmlBuilder (View source)

Traits

Methods

static  void
macro( string $name, callable $macro)

Register a custom macro.

static  boolean
hasMacro( string $name)

Checks if macro is registered

static  mixed
__callStatic( string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call( string $method, array $parameters)

Dynamically handle calls to the class.

void
__construct( UrlGenerator $url = null)

Create a new HTML builder instance.

string
entities( string $value)

Convert an HTML string to entities.

string
decode( string $value)

Convert entities to HTML characters.

string
script( string $url, array $attributes = array(), bool $secure = null)

Generate a link to a JavaScript file.

string
style( string $url, array $attributes = array(), bool $secure = null)

Generate a link to a CSS file.

string
image( string $url, string $alt = null, array $attributes = array(), bool $secure = null)

Generate an HTML image element.

string
link( string $url, string $title = null, array $attributes = array(), bool $secure = null)

Generate a HTML link.

string
secureLink( string $url, string $title = null, array $attributes = array())

Generate a HTTPS HTML link.

string
linkAsset( string $url, string $title = null, array $attributes = array(), bool $secure = null)

Generate a HTML link to an asset.

string
linkSecureAsset( string $url, string $title = null, array $attributes = array())

Generate a HTTPS HTML link to an asset.

string
linkRoute( string $name, string $title = null, array $parameters = array(), array $attributes = array())

Generate a HTML link to a named route.

string
linkAction( string $action, string $title = null, array $parameters = array(), array $attributes = array())

Generate a HTML link to a controller action.

string
mailto( string $email, string $title = null, array $attributes = array())

Generate a HTML link to an email address.

string
email( string $email)

Obfuscate an e-mail address to prevent spam-bots from sniffing it.

string
ol( array $list, array $attributes = array())

Generate an ordered list of items.

string
ul( array $list, array $attributes = array())

Generate an un-ordered list of items.

string
attributes( array $attributes)

Build an HTML attribute string from an array.

string
obfuscate( string $value)

Obfuscate a string to prevent spam-bots from sniffing it.

Details

static void macro( string $name, callable $macro)

Register a custom macro.

Parameters

string $name
callable $macro

Return Value

void

static boolean hasMacro( string $name)

Checks if macro is registered

Parameters

string $name

Return Value

boolean

static mixed __callStatic( string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call( string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

at line line 23
void __construct( UrlGenerator $url = null)

Create a new HTML builder instance.

Parameters

UrlGenerator $url

Return Value

void

at line line 34
string entities( string $value)

Convert an HTML string to entities.

Parameters

string $value

Return Value

string

at line line 45
string decode( string $value)

Convert entities to HTML characters.

Parameters

string $value

Return Value

string

at line line 58
string script( string $url, array $attributes = array(), bool $secure = null)

Generate a link to a JavaScript file.

Parameters

string $url
array $attributes
bool $secure

Return Value

string

at line line 73
string style( string $url, array $attributes = array(), bool $secure = null)

Generate a link to a CSS file.

Parameters

string $url
array $attributes
bool $secure

Return Value

string

at line line 93
string image( string $url, string $alt = null, array $attributes = array(), bool $secure = null)

Generate an HTML image element.

Parameters

string $url
string $alt
array $attributes
bool $secure

Return Value

string

Generate a HTML link.

Parameters

string $url
string $title
array $attributes
bool $secure

Return Value

string

Generate a HTTPS HTML link.

Parameters

string $url
string $title
array $attributes

Return Value

string

at line line 140
string linkAsset( string $url, string $title = null, array $attributes = array(), bool $secure = null)

Generate a HTML link to an asset.

Parameters

string $url
string $title
array $attributes
bool $secure

Return Value

string

at line line 155
string linkSecureAsset( string $url, string $title = null, array $attributes = array())

Generate a HTTPS HTML link to an asset.

Parameters

string $url
string $title
array $attributes

Return Value

string

at line line 169
string linkRoute( string $name, string $title = null, array $parameters = array(), array $attributes = array())

Generate a HTML link to a named route.

Parameters

string $name
string $title
array $parameters
array $attributes

Return Value

string

at line line 183
string linkAction( string $action, string $title = null, array $parameters = array(), array $attributes = array())

Generate a HTML link to a controller action.

Parameters

string $action
string $title
array $parameters
array $attributes

Return Value

string

at line line 196
string mailto( string $email, string $title = null, array $attributes = array())

Generate a HTML link to an email address.

Parameters

string $email
string $title
array $attributes

Return Value

string

at line line 213
string email( string $email)

Obfuscate an e-mail address to prevent spam-bots from sniffing it.

Parameters

string $email

Return Value

string

at line line 225
string ol( array $list, array $attributes = array())

Generate an ordered list of items.

Parameters

array $list
array $attributes

Return Value

string

at line line 237
string ul( array $list, array $attributes = array())

Generate an un-ordered list of items.

Parameters

array $list
array $attributes

Return Value

string

at line line 311
string attributes( array $attributes)

Build an HTML attribute string from an array.

Parameters

array $attributes

Return Value

string

at line line 348
string obfuscate( string $value)

Obfuscate a string to prevent spam-bots from sniffing it.

Parameters

string $value

Return Value

string