class Html
HTML language helper
As for all helpers, all methods are statics.
For convenience, the best practice is to use:
use Library\Helper\Html as HtmlHelper;
Methods
static bool |
hasId(string $reference)
Verify if a reference is already defined in the DOM IDs register |
|
static string |
getId(string $reference = null, string|bool $base_id = null)
Get a DOM unique ID |
|
static string |
getNewId(string $reference = null, string|bool $base_id = null)
Create and get a new DOM unique ID |
|
static |
setHtmlTagClosure(string $closure)
Set the HTML tags closure ( |
|
static string |
writeHtmlTag(string $tag_name, string $content = '', array $attrs = array(), bool $intag_close = false)
Build an HTML string for a specific tag with attributes |
|
static string |
parseAttributes(array $attrs = array())
Build an attributes HTML string from an array like |
|
static string |
javascriptProtect(string $str = '', bool $protect_quotes = false)
Build an HTML string to use in javascripts attributes or functions |
Details
at line 55
static public bool
hasId(string $reference)
Verify if a reference is already defined in the DOM IDs register
at line 67
static public string
getId(string $reference = null, string|bool $base_id = null)
Get a DOM unique ID
at line 85
static public string
getNewId(string $reference = null, string|bool $base_id = null)
Create and get a new DOM unique ID
at line 119
static public
setHtmlTagClosure(string $closure)
Set the HTML tags closure (/>
by default)
at line 133
static public string
writeHtmlTag(string $tag_name, string $content = '', array $attrs = array(), bool $intag_close = false)
Build an HTML string for a specific tag with attributes
at line 150
static public string
parseAttributes(array $attrs = array())
Build an attributes HTML string from an array like variable => value
pairs
at line 166
static public string
javascriptProtect(string $str = '', bool $protect_quotes = false)
Build an HTML string to use in javascripts attributes or functions