H extends Html
Tags
- class
-
H
That's our UI componant class... It generate Html5 componants/widgets and common elements depending main config and properties given As it extends Html class, it use also its magic methods and offer an intuitive usage.
Any unknown static call is routed through __callStatic and creates the corresponding HTML element. The tag name is case-insensitive: H::div() and H::DIV() both produce a
. Common tags used in helPHP are declared below so that IDEs and static analysers (PHPStan) can resolve them.Table of Contents
Constants
- _CHECKMARK_BOLD : mixed = '✔'
- _CHECKMARK_NORMAL : mixed = '✓'
- _DOWN_ARROW : mixed = '↓'
- _DOWN_DASHED_ARROW : mixed = '⇣'
- _LEFT_ARROW : mixed = '←'
- _LEFT_DASHED_ARROW : mixed = '⇠'
- _RIGHT_ARROW : mixed = '→'
- _RIGHT_ARROW_HEAD : mixed = '➤'
- _RIGHT_DASHED_ARROW : mixed = '⇢'
- _STAR_EMPTY : mixed = '☆'
- _STAR_FULL : mixed = '★'
- _UP_ARROW : mixed = '↑'
- _UP_DASHED_ARROW : mixed = '⇡'
- _X_BOLD : mixed = '✖'
- _X_NORMAL : mixed = '✕'
- A : mixed = 'a'
- AUDIO : mixed = 'audio'
- BODY : mixed = 'body'
- BR : mixed = 'br'
- BUTTON : mixed = 'button'
- CANVAS : mixed = 'canvas'
- DATALIST : mixed = 'datalist'
- DETAILS : mixed = 'details'
- DIV : mixed = 'div'
- FIELDSET : mixed = 'fieldset'
- FORM : mixed = 'form'
- HEAD : mixed = 'head'
- HR : mixed = 'hr'
- HTML : mixed = 'html'
- IMAGE : mixed = 'IMAGE'
- IMG : mixed = 'img'
- INPUT : mixed = 'input'
- LABEL : mixed = 'label'
- LEGEND : mixed = 'legend'
- LI : mixed = 'li'
- LINK : mixed = 'link'
- META : mixed = 'meta'
- OPTGROUP : mixed = 'optgroup'
- OPTION : mixed = 'option'
- PARAM : mixed = 'param'
- QUICK_EDIT_DATA : mixed = 'qe_d'
- QUICK_EDIT_FIELD : mixed = 'qe_f'
- QUICK_EDIT_ID : mixed = 'qe_i'
- QUICK_EDIT_TYPE : mixed = 'qe_t'
- QUICK_EDIT_TYPE_INDEX : mixed = 'qe_ti'
- SCRIPT : mixed = 'script'
- SELECT : mixed = 'select'
- simple_tags : mixed = [\helPHP\libs\Html::IMG, \helPHP\libs\Html::IMA...
- SOURCE : mixed = 'source'
- SPAN : mixed = 'span'
- STYLE : mixed = 'style'
- SUMMARY : mixed = 'summary'
- SVG : mixed = 'svg'
- svg_sprite : string = \Config::SVG_SPRITE_ICONS_FILE
- used by H::icons, it define the main svg sheet used.
- TABLE : mixed = 'table'
- TBODY : mixed = 'tbody'
- TD : mixed = 'td'
- TEXTAREA : mixed = 'textarea'
- TFOOT : mixed = 'tfoot'
- TH : mixed = 'th'
- THEAD : mixed = 'thead'
- TITLE : mixed = 'title'
- TR : mixed = 'tr'
- UL : mixed = 'ul'
- USE : mixed = 'use'
- VIDEO : mixed = 'video'
Properties
- $_debug : mixed
- $children : mixed
- $current_value : mixed
- $current_value_label : mixed
- $debug : mixed
- $extra : mixed
- $items_after : mixed
- $label : mixed
- $label_for : mixed
Methods
- __callStatic() : object
- Magic method to handle the call to a static function that does not exist and will create corresponding html/object element
- __construct() : mixed
- Constructor for the H class.
- __get() : mixed
- will execute its parent from Html class
- __set() : mixed
- will execute its parent from Html class
- __toString() : string
- Magic method called when a string operation is done with the current object.
- __unset() : mixed
- will execute its parent from Html class
- _input_translation() : array<string|int, mixed>|object
- this is the base function for input_short_translation and input_long_translation that can be found in HelPHP_module.php. themselves are used in translate_block.
- _LEFT_DASHED_ARROW() : Html
- _RIGHT_ARROW_HEAD() : Html
- _RIGHT_DASHED_ARROW() : Html
- a() : Html
- A() : Html
- add_after() : int|bool
- Adds an item or a list of items to be rendered after the current HTML element.
- add_child() : int|bool
- Adds a child element or a list of child elements to the current HTML element.
- add_class() : void
- Adds a CSS class to the HTML element's class attribute.
- add_debug() : mixed
- advanced_data_grid() : Objet
- As its name indicate it, it do more than the simple grid, there is an additionnal $value_filter used to replace the value to display by textual values.
- after_html() : string
- Generates the HTML for items that should be rendered after the current element.
- ajax_call() : Html
- Description for ajax_call This function generates a script that will execute an AJAX call to the specified URL with the provided data.
- alert() : Html
- BODY() : Html
- BR() : Html
- button() : Html
- BUTTON() : Html
- button_icon() : object
- display a button with and icon inside
- button_icon_with_text() : object
- same as button_icon() but with a text label that can be place on the left or right side of the button
- button_info() : Objet
- Create a informative button
- CANVAS() : Html
- close_document() : object
- Its name says all !
- close_html() : string
- Generates the closing HTML tag for the current element.
- close_tag() : string
- Create a closing tag
- content_html() : string
- Generates the HTML content of the element's children.
- copy_attributes_to() : void
- Copies attributes, data, and extra properties from the current HTML element to another.
- create_instance() : object
- $H is a global used everywhere in HelPHP to call this class methods and create_instance will create it.
- css_loader() : object
- Create a link tag to load a css after the first load of document is done, then move it to document head.
- del_attribute() : void
- Delete an HTML attribute for the element.
- detail() : mixed
- create HTML detail element for accordion effect.
- DETAILS() : Html
- div() : Html
- DIV() : Html
- escape() : string
- Escapes a value for an HTML attribute or for a text node.
- FIELDSET() : Html
- fieldset() : Fieldset
- Creates a fieldset object/HTML element with the given legend.
- find_child() : Html|null
- Recursively searches for a child element within the current HTML element's children.
- FORM() : Html
- form() : mixed
- The Form ! One of the more important tag ! In this class the form created come with multiple automatic features : Fields validation (depending each input) the choice of the div targeted to display the result after a submit (dom_target attributes) or its immediate parent (dom_target='.parent') some custom javascript function to call on submit etc.
- full_html() : string
- Generates the complete HTML for the current object/element, including its opening tag, content, and closing tag.
- get_children() : array<string|int, mixed>
- All is in the name
- get_items_after() : array<string|int, mixed>
- Retrieves the items that should be rendered after the current HTML element.
- get_unique_id() : string
- create the unique_id for html tag
- group() : object
- group of html object.
- HEAD() : Html
- HR() : Html
- HTML() : Html
- icon() : object
- Generates an icon SVG element based on the provided name and attributes.
- image() : object
- Generate an image object/HTML tag based on provided attributes.
- IMG() : Html
- input() : Html
- INPUT() : Html
- input_autocomplete() : object
- The input autocomplete, will search in DB depending the typing or the user to propose a list of available value containing the string.
- input_checkbox() : object
- The classic checkbox set $attributes['checked'] to check it.
- input_colorpicker() : Objet
- Create a colorpicker with the external js alwan colorpicker.
- input_confirmation() : object
- The input confirmation is a classic field used in general to confirm the content of a previous one, like a password or email you need to confirm.
- input_date() : object
- A date selector! Perfect for booking... You can set a minimal and maximal value for an accepted value in a range.
- input_datetime() : object
- A datetime selector! Note that some navigator still got some issue with this kind of input, and sometimes it's better to use an input_date and a separated input_time to cover all needs and possible issue.
- input_email() : object
- Generates an HTML input field for the email type of data.
- input_field() : object
- Generates an input field of the specified type.
- input_file() : object
- The input file can support multiple upload.
- input_float() : object
- You liked the input integer ? here is the same for float... With min max limit for accepted range as well.
- input_hidden() : object
- The hidden input ! you don't see it, but still the best solution to keep some temporary values between two post!
- input_integer() : object
- Another input field dedicated to integers.
- input_login() : object
- Generates an HTML input field for the login type of data.
- input_multiple_radios() : mixed
- create multiple radio
- input_order() : mixed
- the purpose of the input order is to permet to ordonnate a list by a numeric value, and to manipulate it thru drag & drop or manual edition in case you want to manipulate lines of data, you can enclose each line with a DIV with the attribute 'data-order_parent'=>'sort_order['.$post['key'].']' sort order will be the name of the input_order.
- input_password() : object
- Generates an HTML input field for the password type of data.
- input_precomplete() : object
- the input_precomplete is different from input_autocomplete, as it do not ask for data in db at each new char, because it already got the db table inside ansdrequested only one time.
- input_radio() : object
- The classic radio set $attributes['checked'] to indicate which one is checked.
- input_range() : object
- The input range take care of all possibilities of the html5 range tag.
- input_submit_attributes() : array<string|int, mixed>
- Used to add some submit attributes to other input like select
- input_text() : object
- A simple input text
- input_textarea() : object
- A textarea ! But not so simple, because if $attributes['tinymce'] is set, the textarea will be transformed in a tinyMCE instance.
- input_time() : object
- A time selector!
- is_simple() : bool
- check if the tag is a simple one like <br> with no closing tag
- LABEL() : Html
- label_tag() : Html
- Create an Html::Label tag from $label and $attributes or from $this->label and $this->attributes of the current object.
- LEGEND() : Html
- LI() : Html
- LINK() : Html
- load_js() : Objects
- Load_js is used by new_document() only in dev mode.
- META() : Html
- multi_state_button() : object
- The fantastic multistate button ! with tooglable menu ! Will create a div containing a list of buttons with only one active and visible.
- new_document() : object
- Major method that will create all the head elements of a new html output.
- open_html_tag() : string
- Generates the opening HTML tag for the current element.
- open_tag() : string
- Create an opening tag with its attributes
- output() : string
- Will return the current HTML content as string.
- parse_event() : mixed
- Retrieve event that need to pass by event.js it automaticaly removed onclick or onchange and over attributes related to events, to pass them thru the event.js class.
- preview_button() : mixed
- button preview for admin to call preview module.
- quick_edit() : object
- Create a "quick edit" item.
- quick_edit_generate_input() : Objet
- Quick edit input generated depending the preparation done with quick_edit().
- reset_key() : mixed
- Reset key_name
- SCRIPT() : Html
- script() : object
- Create script tag with some special features... if an "autoremove" attribute is specified the script tag will be automatically removed from the html page after 50 milliseconds (default value) or a specified delay in milliseconds.
- script_loader() : object
- Create a script tag to load a script after the first load of document is done.
- select() : object
- To get an input select.
- set_attribute() : void
- Sets an HTML attribute for the element.
- set_extra() : void
- Sets an extra property for the element.
- simple_data_grid() : Objet
- Create quickly a datagrid (with a simple table tag) from a simple key=>value array.
- SOURCE() : Html
- span() : Html
- SPAN() : Html
- STYLE() : Html
- submit_button() : object
- Doing more than a simple submit button.
- submit_button_single() : object
- seems to work just like a submit button only this field will be posted (in addition to all those with the 'alwaysposted' flag)
- SUMMARY() : Html
- SVG() : Html
- table() : Html
- TABLE() : Html
- table_header_row() : mixed
- shortcut for _table_row
- table_row() : mixed
- shortcut for _table_row
- tabs() : Html
- Create tabs inside a page or modal, useful to avoid to rely on navigator tabs.
- tag() : Instance
- Create a new Html instance for a tag
- tbody() : Html
- TBODY() : Html
- td() : Html
- TD() : Html
- TEXTAREA() : Html
- th() : Html
- TH() : Html
- THEAD() : Html
- TITLE() : Html
- tr() : Html
- TR() : Html
- UL() : Html
- USE() : Html
- VIDEO() : Html
Constants
_CHECKMARK_BOLD
public mixed _CHECKMARK_BOLD = '✔'_CHECKMARK_NORMAL
public mixed _CHECKMARK_NORMAL = '✓'_DOWN_ARROW
public mixed _DOWN_ARROW = '↓'_DOWN_DASHED_ARROW
public mixed _DOWN_DASHED_ARROW = '⇣'_LEFT_ARROW
public mixed _LEFT_ARROW = '←'_LEFT_DASHED_ARROW
public mixed _LEFT_DASHED_ARROW = '⇠'_RIGHT_ARROW
public mixed _RIGHT_ARROW = '→'_RIGHT_ARROW_HEAD
public mixed _RIGHT_ARROW_HEAD = '➤'_RIGHT_DASHED_ARROW
public mixed _RIGHT_DASHED_ARROW = '⇢'_STAR_EMPTY
public mixed _STAR_EMPTY = '☆'_STAR_FULL
public mixed _STAR_FULL = '★'_UP_ARROW
public mixed _UP_ARROW = '↑'_UP_DASHED_ARROW
public mixed _UP_DASHED_ARROW = '⇡'_X_BOLD
public mixed _X_BOLD = '✖'_X_NORMAL
public mixed _X_NORMAL = '✕'A
public mixed A = 'a'AUDIO
public mixed AUDIO = 'audio'BODY
public mixed BODY = 'body'BR
public mixed BR = 'br'BUTTON
public mixed BUTTON = 'button'CANVAS
public mixed CANVAS = 'canvas'DATALIST
public mixed DATALIST = 'datalist'DETAILS
public mixed DETAILS = 'details'DIV
public mixed DIV = 'div'FIELDSET
public mixed FIELDSET = 'fieldset'FORM
public mixed FORM = 'form'HEAD
public mixed HEAD = 'head'HR
public mixed HR = 'hr'HTML
public mixed HTML = 'html'IMAGE
public mixed IMAGE = 'IMAGE'IMG
public mixed IMG = 'img'INPUT
public mixed INPUT = 'input'LABEL
public mixed LABEL = 'label'LEGEND
public mixed LEGEND = 'legend'LI
public mixed LI = 'li'LINK
public mixed LINK = 'link'META
public mixed META = 'meta'OPTGROUP
public mixed OPTGROUP = 'optgroup'OPTION
public mixed OPTION = 'option'PARAM
public mixed PARAM = 'param'QUICK_EDIT_DATA
public mixed QUICK_EDIT_DATA = 'qe_d'QUICK_EDIT_FIELD
public mixed QUICK_EDIT_FIELD = 'qe_f'QUICK_EDIT_ID
public mixed QUICK_EDIT_ID = 'qe_i'QUICK_EDIT_TYPE
public mixed QUICK_EDIT_TYPE = 'qe_t'QUICK_EDIT_TYPE_INDEX
public mixed QUICK_EDIT_TYPE_INDEX = 'qe_ti'SCRIPT
public mixed SCRIPT = 'script'SELECT
public mixed SELECT = 'select'simple_tags
public mixed simple_tags = [\helPHP\libs\Html::IMG, \helPHP\libs\Html::IMAGE, \helPHP\libs\Html::BR, \helPHP\libs\Html::HR, \helPHP\libs\Html::INPUT, \helPHP\libs\Html::LINK, \helPHP\libs\Html::META, \helPHP\libs\Html::PARAM, \helPHP\libs\Html::USE]SOURCE
public mixed SOURCE = 'source'SPAN
public mixed SPAN = 'span'STYLE
public mixed STYLE = 'style'SUMMARY
public mixed SUMMARY = 'summary'SVG
public mixed SVG = 'svg'svg_sprite
used by H::icons, it define the main svg sheet used.
public string svg_sprite = \Config::SVG_SPRITE_ICONS_FILEthe original sheet comes from https://feathericons.com/
TABLE
public mixed TABLE = 'table'TBODY
public mixed TBODY = 'tbody'TD
public mixed TD = 'td'TEXTAREA
public mixed TEXTAREA = 'textarea'TFOOT
public mixed TFOOT = 'tfoot'TH
public mixed TH = 'th'THEAD
public mixed THEAD = 'thead'TITLE
public mixed TITLE = 'title'TR
public mixed TR = 'tr'UL
public mixed UL = 'ul'USE
public mixed USE = 'use'VIDEO
public mixed VIDEO = 'video'Properties
$_debug
public static mixed $_debug = false$children
public mixed $children = array()$current_value
public mixed $current_value = null$current_value_label
public mixed $current_value_label = null$debug
public mixed $debug = false$extra
public mixed $extra = []$items_after
public mixed $items_after = array()$label
public mixed $label = ''$label_for
public mixed $label_for = falseMethods
__callStatic()
Magic method to handle the call to a static function that does not exist and will create corresponding html/object element
public static __callStatic(string $name, array<string|int, mixed> $args) : objectParameters
- $name : string
-
the function/html element name
- $args : array<string|int, mixed>
-
[0] : the html attributes as a key pairs array, [1] : the content of the tag
Return values
object —Html element
__construct()
Constructor for the H class.
public __construct([string $tag_name = '' ][, array<string|int, mixed>|null $attributes = null ][, mixed|null $data = null ]) : mixedThis method initializes a new instance of the H class with the specified tag name, attributes, and data. will simply execute the construct of Html class.
Parameters
- $tag_name : string = ''
-
The name of the HTML tag to use for this element (e.g., 'div', 'p', etc.).
- $attributes : array<string|int, mixed>|null = null
-
An array of key-value pairs representing the attributes for this element.
- $data : mixed|null = null
-
Additional data to be used when creating this element. in general its content/innerhtml
Tags
- see
- construct
__get()
will execute its parent from Html class
public __get(mixed $property) : mixedParameters
- $property : mixed
Tags
- see
- __get
__set()
will execute its parent from Html class
public __set(mixed $property, mixed $value) : mixedParameters
- $property : mixed
- $value : mixed
-
The value to set for the property.
Tags
- see
- __set
__toString()
Magic method called when a string operation is done with the current object.
public __toString() : stringit will act as a shortcut to full_html().
Return values
string —A string representation of the current HTML element.
__unset()
will execute its parent from Html class
public __unset(mixed $property) : mixedParameters
- $property : mixed
Tags
- see
- __unset
_input_translation()
this is the base function for input_short_translation and input_long_translation that can be found in HelPHP_module.php. themselves are used in translate_block.
public static _input_translation(array<string|int, mixed> $attributes[, int $id = 0 ][, bool $short = true ]) : array<string|int, mixed>|objectParameters
- $attributes : array<string|int, mixed>
- $id : int = 0
- $short : bool = true
-
if true return an input text, false a textarea
Tags
- see
- input_short_translation
- input_long_translation
- translate_block
Return values
array<string|int, mixed>|object —of multiple input text or textarea depending the number of languages ans short type true/false
_LEFT_DASHED_ARROW()
public static _LEFT_DASHED_ARROW([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Html_RIGHT_ARROW_HEAD()
public static _RIGHT_ARROW_HEAD([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Html_RIGHT_DASHED_ARROW()
public static _RIGHT_DASHED_ARROW([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmla()
public static a([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlA()
public static A([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmladd_after()
Adds an item or a list of items to be rendered after the current HTML element.
public add_after(mixed $itemList[, string $key_name = '' ]) : int|boolParameters
- $itemList : mixed
-
The item(s) to add. Can be a single Html object, a string, or an array of Html objects or strings.
- $key_name : string = ''
-
Optional key name for the item if it's a single item and needs a specific key.
Return values
int|bool —Returns the index of the last added item if successful, or false if the item list is invalid.
add_child()
Adds a child element or a list of child elements to the current HTML element.
public add_child(mixed $child_list[, string $key_name = '' ]) : int|boolParameters
- $child_list : mixed
-
The child element(s) to add. Can be a single Html object, a string, or an array of Html objects or strings.
- $key_name : string = ''
-
Optional key name for the child element if it's a single element and needs a specific key.
Return values
int|bool —Returns the index of the last added child if successful, or false if the element is simple or the child list is invalid. If a key is provided the child is added by the given key and the function return the index of the added element.
add_class()
Adds a CSS class to the HTML element's class attribute.
public add_class(string $value) : voidParameters
- $value : string
-
The CSS class to add.
add_debug()
public add_debug(mixed $item) : mixedParameters
- $item : mixed
advanced_data_grid()
As its name indicate it, it do more than the simple grid, there is an additionnal $value_filter used to replace the value to display by textual values.
public static advanced_data_grid(array<string|int, mixed> $liste[, array<string|int, mixed> $columns_filter = null ][, null $values_filter = null ][, string $id = false ][, array<string|int, mixed> $options = [] ]) : Objetexemple : the returned data contains a size field with possible values 0,1,2 $values_filter = array('size'=> array( 0=>'undefined' , 1=>'small' , 2=>'tall' ) ); instead of displaying 0,1,2 in the cells , it will display 'small' or 'tall' etc...
$options completes the grid for the lists a module builds itself today (users, document, notification): a sortable header, a pagination bar, cells built by a callback and an action column. Every key is optional, and without $options the output is the plain table it always was. The classes are the ones the theme expects on a result list, prefixed with
class_prefix(a module passes its own $this->css there, e.g. 'users_admin_').'class_prefix' => string, prefix of every class emitted (default '') 'sort' => ['module'=>…, 'dom_id'=>…, 'field'=>…, 'dir'=>'a'|'d', 'first_dir'=>'a'|'d', 'token'=>callable($key), 'columns'=>[key => bool]] 'token' turns a key into the value H_search.filter() posts back ($CRYPT->encrypt($key) for instance); 'first_dir' is the direction the first click on an unsorted column asks for ('d' when omitted); 'columns' limits the sort to the columns that can be sorted (all of them by default). 'pages' => ['index'=>0-based, 'count'=>page count, 'limit'=>per page, 'module'=>…, 'dom_id'=>…, 'params'=>[extra posted values], 'previous_label'=>…, 'next_label'=>…] 'render' => [key => callable($value, $line)] cell content instead of the raw value 'actions' => callable($line) returning the node(s) of the last column 'actions_label' => label of that last column (empty header by default, as in users) 'row_id' => callable($line) returning the id attribute of a row
Parameters
- $liste : array<string|int, mixed>
- $columns_filter : array<string|int, mixed> = null
- $values_filter : null = null
- $id : string = false
-
for the grid
- $options : array<string|int, mixed> = []
Return values
Objet —Html table
after_html()
Generates the HTML for items that should be rendered after the current element.
public after_html([int $l = 0 ]) : stringThis method iterates through the items in the
items_afterarray. If an item is an Html object, it recursively calls itsfull_htmlmethod. Otherwise, it treats the item as a string.Parameters
- $l : int = 0
-
The current indentation level (for pretty printing).
Return values
string —The HTML content of the items to be rendered after.
ajax_call()
Description for ajax_call This function generates a script that will execute an AJAX call to the specified URL with the provided data.
public static ajax_call(string $url, array<string|int, mixed> $data[, null|string $target = null ][, int $delay = 0 ]) : HtmlUseful in rare case when you can't initialize de JS module.
Parameters
- $url : string
- $data : array<string|int, mixed>
-
of values to send
- $target : null|string = null
-
to receive result
- $delay : int = 0
-
before launching the script
Return values
Html —script tag to execute the ajax call
alert()
public static alert([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlBODY()
public static BODY([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlBR()
public static BR([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlbutton()
public static button([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlBUTTON()
public static BUTTON([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlbutton_icon()
display a button with and icon inside
public static button_icon(mixed $name[, mixed $attributes = [] ]) : objectParameters
- $name : mixed
-
icon name to display
- $attributes : mixed = []
Tags
- see
-
icon
you can also use the admin module Icon to pick the icon needed and just add "button_" like this : H:button_icon('picked icon name') to get it quickly.
Return values
object —H::BUTTON with the generated SVG Object element containing the icon.
button_icon_with_text()
same as button_icon() but with a text label that can be place on the left or right side of the button
public static button_icon_with_text(mixed $name[, string $side = 'right' ][, string $label = '' ][, array<string|int, mixed> $attributes = [] ]) : objectParameters
- $name : mixed
-
of the icpn
- $side : string = 'right'
-
'left' or 'right' default
- $label : string = ''
- $attributes : array<string|int, mixed> = []
Tags
- see
-
icon
you can also use the admin module Icon to pick the icon needed and just call the function like this : H:button_icon_with_text('picked icon name','left','text label') to get it quickly.
Return values
object —H::BUTTON with the generated SVG Object element containing the icon and a SPAN with the text label
button_info()
Create a informative button
public static button_info(array<string|int, mixed> $attributes, string|object $content[, string $type = 'text' ]) : ObjetWhen clicked display a modal aside with content given to the method, used to display information to the user
Parameters
- $attributes : array<string|int, mixed>
- $content : string|object
-
, either string or HTML object
- $type : string = 'text'
-
Optional, determine the type of string given (text, link)
Return values
Objet —Html div container
CANVAS()
public static CANVAS([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlclose_document()
Its name says all !
public static close_document() : objectReturn values
object —Html body and html closing tags
close_html()
Generates the closing HTML tag for the current element.
public close_html() : stringReturn values
string —The closing HTML tag.
close_tag()
Create a closing tag
public static close_tag(mixed $tag_name) : stringParameters
- $tag_name : mixed
Return values
stringcontent_html()
Generates the HTML content of the element's children.
public content_html([int $l = 0 ]) : stringThis method iterates through the children of the current HTML element. If a child is an Html object, it recursively calls its
full_htmlmethod. Otherwise, it treats the child as a string.Parameters
- $l : int = 0
-
The current indentation level (for pretty printing).
Return values
string —The HTML content of the children.
copy_attributes_to()
Copies attributes, data, and extra properties from the current HTML element to another.
public copy_attributes_to(Html $destination_tag) : voidParameters
- $destination_tag : Html
-
The target HTML element to copy attributes to.
create_instance()
$H is a global used everywhere in HelPHP to call this class methods and create_instance will create it.
public static create_instance([bool $forceNewInstance = false ]) : object..
Parameters
- $forceNewInstance : bool = false
Return values
object —global $H
css_loader()
Create a link tag to load a css after the first load of document is done, then move it to document head.
public static css_loader(string $url) : objectParameters
- $url : string
Return values
object —html link
del_attribute()
Delete an HTML attribute for the element.
public del_attribute(string $name) : voidcan be useful for boolean attributes, like "controls" for video
Parameters
- $name : string
-
The name of the attribute.
detail()
create HTML detail element for accordion effect.
public static detail(mixed $params[, mixed $label = null ]) : mixedParameters
- $params : mixed
- $label : mixed = null
DETAILS()
public static DETAILS([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmldiv()
public static div([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlDIV()
public static DIV([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlescape()
Escapes a value for an HTML attribute or for a text node.
public static escape(mixed $value) : stringOne policy for the whole toolkit: an attribute value is always a string, quotes are encoded, and an invalid UTF-8 sequence becomes the substitution character instead of making htmlspecialchars() return an empty string. Every site that escapes by hand must call this, so that a change of flags happens in one place.
Parameters
- $value : mixed
Return values
stringFIELDSET()
public static FIELDSET([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlfieldset()
Creates a fieldset object/HTML element with the given legend.
public static fieldset([array<string|int, mixed>|null $attributes = null ][, string $legend = '' ]) : FieldsetParameters
- $attributes : array<string|int, mixed>|null = null
-
Additional attributes to apply to the fieldset tag.
- $legend : string = ''
-
The text content of the legend tag. Defaults to an empty string.
Return values
Fieldset —The created Fieldset object with the added legend child.
find_child()
Recursively searches for a child element within the current HTML element's children.
public find_child(string $key_name[, int $maxRecursion = 0 ][, Html|null $parent = null ][, int $level = 0 ]) : Html|nullParameters
- $key_name : string
-
The key name of the child element to find.
- $maxRecursion : int = 0
-
The maximum recursion depth for the search. Default is 0 (only direct children are searched).
- $parent : Html|null = null
-
The parent element to start the search from. Defaults to the current element.
- $level : int = 0
-
The current recursion level.
Return values
Html|null —Returns the found child element as an Html object, or null if not found. If the key name is found in the direct children, it returns that child.
FORM()
public static FORM([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlform()
The Form ! One of the more important tag ! In this class the form created come with multiple automatic features : Fields validation (depending each input) the choice of the div targeted to display the result after a submit (dom_target attributes) or its immediate parent (dom_target='.parent') some custom javascript function to call on submit etc.
public static form([array<string|int, mixed>|null $attributes = null ][, array<string|int, mixed>|string|null $content = '' ][, string $custom_submit_function = '' ]) : mixedclassic form ex : $form = H::form(['action'=>$this->get_index_relative_path(), 'dom_target'=>$this->dom_target, 'class'=>'my_form']); the value coming with $this are coming from helPHP_module in this example...
Parameters
- $attributes : array<string|int, mixed>|null = null
-
list of html attributes
- $content : array<string|int, mixed>|string|null = ''
-
content of the form
- $custom_submit_function : string = ''
-
javascript function to call when submitting the form
full_html()
Generates the complete HTML for the current object/element, including its opening tag, content, and closing tag.
public full_html([int $l = 0 ]) : stringThis method orchestrates the generation of the full HTML representation of the element. It handles both standard HTML tags and tag-less groups of children. For standard tags, it calls
open_html_tag,content_html, andclose_html. For simple tags (like
), it omits the content and closing tag. It also appends any HTML content specified to be rendered after the element.Parameters
- $l : int = 0
-
The current indentation level for pretty-printing the HTML.
Return values
string —The complete HTML string for the element.
get_children()
All is in the name
public get_children() : array<string|int, mixed>Return values
array<string|int, mixed> —Returns an array containing the child elements of the current HTML element.
get_items_after()
Retrieves the items that should be rendered after the current HTML element.
public get_items_after() : array<string|int, mixed>Return values
array<string|int, mixed> —Returns an array containing the item to be rendered after.
get_unique_id()
create the unique_id for html tag
public static get_unique_id() : stringReturn values
stringgroup()
group of html object.
public static group([mixed $key_name = '' ]) : objectThis little and useful function create a new empty Html instance object. So it can receive childs etc and permit various operation on groups of html objet to merge them etc. Very often used for display_output : $output = new H::group('my_display'); $output->add_child([...,...]); return $output;
Parameters
- $key_name : mixed = ''
-
=''
Return values
object —Html group
HEAD()
public static HEAD([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlHR()
public static HR([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlHTML()
public static HTML([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlicon()
Generates an icon SVG element based on the provided name and attributes.
public static icon(string $name[, array<string|int, mixed> $attributes = [] ]) : objectThe SVG spreadsheet is a collection of def/symboles. To easily pick one you'll find a very useful admin module named "Icons" that will present to you all the icons in the speadsheet and will permit to search and pick one by clicking on it (it will copy an H:icon('picked icon name') in your clipboard ) and you'll just need to paste the icon at the right place in your code.
Note : it's creating an SVG, so if you want to add an event on it, you should embed it in a div and put the event on it.
Parameters
- $name : string
-
The name of the icon to be used in the #id attribute of the
- $attributes : array<string|int, mixed> = []
-
Optional attributes for the icon, including class and style. Defaults to an empty array.
Return values
object —H::SVG The generated SVG Object element containing the icon.
image()
Generate an image object/HTML tag based on provided attributes.
public static image(mixed $attributes) : objectParameters
- $attributes : mixed
-
The attributes for the image tag. Can be passed as associative array, or 'src' value.
Return values
object —The generated image object/HTML tag.
IMG()
public static IMG([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlinput()
public static input([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlINPUT()
public static INPUT([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlinput_autocomplete()
The input autocomplete, will search in DB depending the typing or the user to propose a list of available value containing the string.
public static input_autocomplete([array<string|int, mixed> $params = [] ][, null $table_name = null ][, null $field_name = null ][, bool $submit_on_change = false ][, bool $callback = false ]) : objectOther element in the parent form with 'data-autocomp' in parameters will be sent with this input
It's working by sending ajax requests from H_ui_autocomplete to the default autocomplete function in HelPHP_module. Of course it can be extended in a HelPHP module.
Parameters
- $params : array<string|int, mixed> = []
-
with key pairs : name -> the name for the posted input value -> the current id for the hidden field value_label -> the label for the id, in the text field label -> is the label to put before the visible field in the form. class -> css class to add
- $table_name : null = null
-
the name of the table in db
- $field_name : null = null
-
the name of the field in db
- $submit_on_change : bool = false
-
does it send the form when selecting in the list
- $callback : bool = false
-
a js callback
Tags
- see
-
take
a look in the admin users module to find some input autocomplete at work with extended exemple.
Return values
object —Html div / autocomplete widget
input_checkbox()
The classic checkbox set $attributes['checked'] to check it.
public static input_checkbox(array<string|int, mixed> $attributes[, mixed $post = null ]) : objectParameters
- $attributes : array<string|int, mixed>
- $post : mixed = null
-
the current post
Return values
object —html input checkbox
input_colorpicker()
Create a colorpicker with the external js alwan colorpicker.
public static input_colorpicker(mixed $attributes) : Objetthe value is in class html hexa value (e.g:#FFFFFF)
Parameters
- $attributes : mixed
Return values
Objet —Html div
input_confirmation()
The input confirmation is a classic field used in general to confirm the content of a previous one, like a password or email you need to confirm.
public static input_confirmation(object $original_input[, string $label = '[confirm]' ]) : objectParameters
- $original_input : object
-
the original field that needed to be confimed
- $label : string = '[confirm]'
Return values
object —html input confirm with similar aspect of the orginal input
input_date()
A date selector! Perfect for booking... You can set a minimal and maximal value for an accepted value in a range.
public static input_date([array<string|int, mixed>|null $attributes = null ]) : objectParameters
- $attributes : array<string|int, mixed>|null = null
Tags
- see
-
input_datetime()
if hours matters
Return values
object —html input
input_datetime()
A datetime selector! Note that some navigator still got some issue with this kind of input, and sometimes it's better to use an input_date and a separated input_time to cover all needs and possible issue.
public static input_datetime([array<string|int, mixed>|null $attributes = null ]) : objectParameters
- $attributes : array<string|int, mixed>|null = null
Return values
object —html input
input_email()
Generates an HTML input field for the email type of data.
public static input_email([array<string|int, mixed>|null $attributes = null ]) : objectParameters
- $attributes : array<string|int, mixed>|null = null
-
of the input element. If null, default attributes will be used.
Return values
object —The generated HTML input email field.
input_field()
Generates an input field of the specified type.
public static input_field(string $type[, array<string|int, mixed> $attributes = null ]) : objectvalidation process is automaticaly made depending the type This function is a global shortcut to all input_xxx ones you can find bellow.
Parameters
- $type : string
-
The type of input field to generate. One of:
- 'login'
- 'password'
- 'email'
- 'integer'
- 'float'
- 'date'
- 'textarea'
- 'hidden'
- 'file'
- 'bool' / 'checkbox'
- 'radio'
- 'varchar'
- 'char'
- 'text'
- $attributes : array<string|int, mixed> = null
-
Optional. Additional attributes to pass to the input field.
Return values
object —/ Html input
input_file()
The input file can support multiple upload.
public static input_file(array<string|int, mixed> $attributes) : objectThose are chunked uploads automaticaly managed by our Ajax JS and PHP class Nothing special to do, you'll reveice your file(s) in $_FILE as usual, but the Ajax\process_file() method will help you move/process them. But if you want to upload image or video you should take a look on the Media module that offer a lot more.
Parameters
- $attributes : array<string|int, mixed>
Return values
object —html input
input_float()
You liked the input integer ? here is the same for float... With min max limit for accepted range as well.
public static input_float([array<string|int, mixed>|null $attributes = null ][, int|null $min = null ][, int|null $max = null ]) : objectParameters
- $attributes : array<string|int, mixed>|null = null
- $min : int|null = null
- $max : int|null = null
Return values
object —html input
input_hidden()
The hidden input ! you don't see it, but still the best solution to keep some temporary values between two post!
public static input_hidden(array<string|int, mixed> $attributes) : objectParameters
- $attributes : array<string|int, mixed>
Return values
object —html input
input_integer()
Another input field dedicated to integers.
public static input_integer([array<string|int, mixed>|null $attributes = null ][, int|null $min = null ][, int|null $max = null ]) : objectYou can set a minimal and maximal value for an accepted value in a range. accept only integers (of course )
Parameters
- $attributes : array<string|int, mixed>|null = null
- $min : int|null = null
- $max : int|null = null
Return values
object —html input
input_login()
Generates an HTML input field for the login type of data.
public static input_login([array<string|int, mixed>|null $attributes = null ]) : objectParameters
- $attributes : array<string|int, mixed>|null = null
-
of the input element. If null, default attributes will be used.
Return values
object —The generated HTML input login field.
input_multiple_radios()
create multiple radio
public static input_multiple_radios(array<string|int, mixed> $attributes) : mixedadd a values key to attributes with the list of values.
Parameters
- $attributes : array<string|int, mixed>
-
Associative array. Some value are required to work properly:
- values : array of array with label and value inside, each one display a choice
- name : name's in form
input_order()
the purpose of the input order is to permet to ordonnate a list by a numeric value, and to manipulate it thru drag & drop or manual edition in case you want to manipulate lines of data, you can enclose each line with a DIV with the attribute 'data-order_parent'=>'sort_order['.$post['key'].']' sort order will be the name of the input_order.
public static input_order(array<string|int, mixed> $params[, bool $editable = false ][, mixed $callback = '' ]) : mixedthere can multiple inpu_order series, do it's the name of it that identifie and seperated the various input_order group. exemple: in this exemple we list a DB prepared_query_list and create a div for each line of value and an input order each one, so for each line :
//we create a div for the line $linediv = H::DIV(['class'=>$this->css.'field', 'data-order_parent'=>'sort_order['.$post['key'].']'],$line['value']); //first we check if an order is already given... $val_order = (isset($post['sort_order'])) ? $post['sort_order'] : ($post['key']+1); $order = H::input_order(['name'=>'sort_order['.$post['key'].']', 'value'=>$val_order, 'class'=>$this->css.'order']); we add the order input to the parent div of the line... $linediv->add_child($order);
Parameters
- $params : array<string|int, mixed>
-
, general parameter for the input like. Need to have name and value to work.
- $editable : bool = false
-
, true if the order can be change with an input integer
- $callback : mixed = ''
input_password()
Generates an HTML input field for the password type of data.
public static input_password([array<string|int, mixed>|null $attributes = null ]) : objectParameters
- $attributes : array<string|int, mixed>|null = null
-
of the input element. If null, default attributes will be used.
Return values
object —The generated HTML input password field.
input_precomplete()
the input_precomplete is different from input_autocomplete, as it do not ask for data in db at each new char, because it already got the db table inside ansdrequested only one time.
public static input_precomplete(array<string|int, mixed> $params[, array<string|int, mixed> $list_data = [] ][, bool $submit_on_change = false ][, false|string $callback = false ]) : objectIt's perfect for a small batch of data like to choose a country or search... you'll find exemple in the admin category module.
Parameters
- $params : array<string|int, mixed>
-
with key pairs :
- name (string) : name for the posted input
- value (string) : current id for the hidden field
- value_label (string) : label for the id, in the text field
- label (string) : label to put before the visible field in the form.
- class (string, optional) :css class to add
- $list_data : array<string|int, mixed> = []
-
is an array like the opt_data in select, with label_key, value_key, data, (optionnal) first_empty
- $submit_on_change : bool = false
-
can be false | true, submit form on change
- $callback : false|string = false
-
a javascript callback to call when change
Return values
object —Html div / precomplete widget
input_radio()
The classic radio set $attributes['checked'] to indicate which one is checked.
public static input_radio(array<string|int, mixed> $attributes) : objectParameters
- $attributes : array<string|int, mixed>
Tags
- see
-
input_multiple_radios()
to create all radios in one go
Return values
object —html input radio
input_range()
The input range take care of all possibilities of the html5 range tag.
public static input_range(array<string|int, mixed> $attributes[, float $min = null ][, float $max = null ][, float $step = null ][, string $value = null ][, string $orient = null ]) : objectWith step and limits it can also be used to represent a playing track.
Parameters
- $attributes : array<string|int, mixed>
- $min : float = null
-
minimal limitation
- $max : float = null
-
maximal limitation
- $step : float = null
-
the precision of the step will define also the precision of the range
- $value : string = null
-
=null
- $orient : string = null
-
=null (vertical or horizontal for firefox) you can also add "writing-mode" or "direction" in $attributes array.
Return values
object —html input range
input_submit_attributes()
Used to add some submit attributes to other input like select
public static input_submit_attributes(string $submit_varname, string $submit_varvalue) : array<string|int, mixed>Parameters
- $submit_varname : string
- $submit_varvalue : string
Return values
array<string|int, mixed> —attributes
input_text()
A simple input text
public static input_text(array<string|int, mixed> $attributes) : objectParameters
- $attributes : array<string|int, mixed>
Return values
object —html input
input_textarea()
A textarea ! But not so simple, because if $attributes['tinymce'] is set, the textarea will be transformed in a tinyMCE instance.
public static input_textarea(array<string|int, mixed> $attributes) : objectParameters
- $attributes : array<string|int, mixed>
Return values
object —html input
input_time()
A time selector!
public static input_time([array<string|int, mixed>|null $attributes = null ]) : objectParameters
- $attributes : array<string|int, mixed>|null = null
Return values
object —html input
is_simple()
check if the tag is a simple one like <br> with no closing tag
public static is_simple(mixed $tag_name) : boolParameters
- $tag_name : mixed
Return values
bool —true false
LABEL()
public static LABEL([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmllabel_tag()
Create an Html::Label tag from $label and $attributes or from $this->label and $this->attributes of the current object.
public label_tag([string $label = null ][, array<string|int, mixed> $attributes = null ][, mixed $children = null ]) : HtmlParameters
- $label : string = null
- $attributes : array<string|int, mixed> = null
- $children : mixed = null
Return values
Html —object Html::label
LEGEND()
public static LEGEND([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlLI()
public static LI([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlLINK()
public static LINK([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlload_js()
Load_js is used by new_document() only in dev mode.
public static load_js([bool $public = true ][, string $pre = '' ][, string $refresher = '' ]) : ObjectsIt's used to cp the available js of module in tmp folder on the instance to permit debug .
Parameters
- $public : bool = true
- $pre : string = ''
-
the base usl pre tmp
- $refresher : string = ''
-
a timestamp or any changing value to force reload.
Return values
Objects —Html bunch of scripts tag
META()
public static META([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlmulti_state_button()
The fantastic multistate button ! with tooglable menu ! Will create a div containing a list of buttons with only one active and visible.
public static multi_state_button(array<string|int, mixed> $params, mixed $btns, int $index_active[, string $side = '' ][, mixed $toggle_mode = false ]) : objectclicking on the current button will execute its events then display the next one.
Parameters
- $params : array<string|int, mixed>
-
parameters array for container (id, class, dataset...)
- $btns : mixed
- $index_active : int
-
the index in btns array of the current active button, the one that is selected by default if -1, no buttons active by default but the fist one will be used as avatar
- $side : string = ''
-
add "side"css class to the element to indicate on which side should toogle the button menu
- $toggle_mode : mixed = false
-
=false
Return values
object —Html sort of button
new_document()
Major method that will create all the head elements of a new html output.
public static new_document(string $title, mixed $keywords, mixed $description[, mixed $meta_data = false ][, mixed $public = false ][, mixed $canonical = false ][, mixed $theme = false ]) : objectit will manage the embeding of the javascripts and css files depending if we are in dev or production mode. But also the indexations and socials tags for indexable documents.
Parameters
- $title : string
-
The title of the page. @param String $keywords : all the keywords for meta keywords @param Array $meta_data : meta tags as key pairs (name => value). @param Bool $public indicate if this head is for the front or backoffice / admin side @param String|Bool $canonical is used for sitemap indexation to indicate the original document in case of double URL @param Int $theme ID of the theme to load.
- $keywords : mixed
- $description : mixed
- $meta_data : mixed = false
- $public : mixed = false
- $canonical : mixed = false
- $theme : mixed = false
Return values
object —The complete head of the HTML document.
open_html_tag()
Generates the opening HTML tag for the current element.
public open_html_tag() : stringThis includes the tag name and all its attributes (standard and data-*). It also handles special cases like the DOCTYPE for the tag and event parsing for JavaScript integration. For quick edit fields/forms, it encrypt the field infos to avoid XSS or SQL injection.
Return values
string —The opening HTML tag as a string.
open_tag()
Create an opening tag with its attributes
public static open_tag(mixed $tag_name[, null $attributes = null ]) : stringParameters
- $tag_name : mixed
- $attributes : null = null
Return values
stringoutput()
Will return the current HTML content as string.
public static output(mixed $htmlContent) : stringEcho force the call to magic method __toString that will convert everything with full_html()
Parameters
- $htmlContent : mixed
Return values
string —html
parse_event()
Retrieve event that need to pass by event.js it automaticaly removed onclick or onchange and over attributes related to events, to pass them thru the event.js class.
public parse_event() : mixedThis will avoid conflict and permit multiple similar events on the same tag Except for A tag because they need to stop the original event to not trig the page reload This function is called automaticaly
preview_button()
button preview for admin to call preview module.
public static preview_button(mixed $module, mixed $id[, mixed $label = '' ][, mixed $admin = false ][, mixed $extra_params = false ]) : mixedParameters
- $module : mixed
- $id : mixed
- $label : mixed = ''
- $admin : mixed = false
- $extra_params : mixed = false
quick_edit()
Create a "quick edit" item.
public static quick_edit(Objet $form, string $id, string $field_identifier[, array<string|int, mixed> $attributes = [] ][, string $text = '' ][, string $type = 'text' ][, int $id_lang_data = null ]) : objecta "quick edit" a start seems to be a simple text, but after a double click/tap on it, it transform as a input field that permit to edit the value of the text. After validation, the value is updated in the DB. useful when there is only one thing to edit in a page or with complexe pagination or when you need to enlight the UI. you can have one form object for multiple quick edit item.
exemple : $my_quick_edit = H::quick_edit($form, $line['id'], ['class'=>'myqe'], $this->ifld_data_value, $line['value'], 'float');
Parameters
- $form : Objet
-
the H::form() that will integrate the field
- $id : string
-
integer id of the field in database
- $field_identifier : string
-
the name to send, with format module_table-field
- $attributes : array<string|int, mixed> = []
-
to add the html element (like other elements)
- $text : string = ''
-
text to display
- $type : string = 'text'
-
of the field to enable validation
- $id_lang_data : int = null
-
if translatable field, the id of the language
Tags
- see
- quick_edit_generate_input()
Return values
object —Html item that will transform as a typed input
quick_edit_generate_input()
Quick edit input generated depending the preparation done with quick_edit().
public static quick_edit_generate_input(int $id, mixed $value, mixed $type_index, mixed $field_data[, null $id_lang_data = null ][, array<string|int, mixed> $attributes = [] ]) : Objetthis function is automaticaly called by HelPHP_module and create the mini form with current value
Parameters
- $id : int
- $value : mixed
- $type_index : mixed
- $field_data : mixed
- $id_lang_data : null = null
- $attributes : array<string|int, mixed> = []
Return values
Objet —Html block
reset_key()
Reset key_name
public reset_key([mixed $newValue = '' ]) : mixedParameters
- $newValue : mixed = ''
SCRIPT()
public static SCRIPT([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlscript()
Create script tag with some special features... if an "autoremove" attribute is specified the script tag will be automatically removed from the html page after 50 milliseconds (default value) or a specified delay in milliseconds.
public static script(mixed $content[, null $attributes = null ]) : objectSo if the user inspect the page source to find this js, there will be nothing (useful for security). this allows you to run a punctual piece of javascript, without polluting the page afterwards If async="async": The script is executed asynchronously with the rest of the page (the script will be executed while the page continues the parsing) If async is not present and defer="defer": The script is executed when the page has finished parsing If neither async or defer is present: The script is fetched and executed immediately, before the browser continues parsing the page
Parameters
- $content : mixed
- $attributes : null = null
Return values
object —html script
script_loader()
Create a script tag to load a script after the first load of document is done.
public static script_loader(string $url) : objectParameters
- $url : string
Return values
object —html script
select()
To get an input select.
public static select(array<string|int, mixed> $attributes, array<string|int, mixed> $options_data[, null $default_value = null ][, string $submit_varname = '' ][, string $submit_varvalue = '' ]) : objectthe form can be posted automatically when changing the value of this select two other parameters must be specified : $submit_varname : action variable name $submit_varvalue : action variable value
Parameters
- $attributes : array<string|int, mixed>
- $options_data : array<string|int, mixed>
-
an array containing the list of options to display (usually a result of sql query) value_key : the name of the field containing the value of each option of the select label_key : the name of the field containing the text to display in each option of the select
first_empty (optional) : true if it is necessary to display an empty value at the beginning of the list or an array representing the element to display at the start of the list, formatted as the options are: [value_key => "value", label_key => "label"]
groups (optional) : an array used to create groups from a field in the options table
exemple : 'groups'=>['model'=> [0=>'Thing' , 1=>'Another Thing'] ]); the 'model' field will be used to define the groups, the items with model = 0 will go in the group labeled 'Thing', those with the value 1 will go in the group with the label 'Another Thing'
IMPORTANT: two special keys are predefined: 'null' and '?' the group with 'null' will receive all the elements whose specified field contains the value NULL the group with '?' will receive all items that do not have an identified value in another group
full exemple usage with a list coming from db for: // we get the data $q = 'SELECT id, name FROM '. $DB->table('xxxx_data').' ORDER BY name'; $list = $DB->prepared_query_list($q); //check if there is already a posted id $selected_id = isset($post[$this->build_module_field_name('xxxx','data','id')]) ? $post[$this->build_module_field_name('xxxx','data','id')] : 0; //setting up all options data $opts_data = array('first_empty'=>true, 'value_key'=>'id', 'label_key'=>'name', 'options'=>$list); //getting the select $select = H::select(['name'=>$this->build_module_field_name('xxxx','data','id'), 'label'=>$this->get_tl('my_select')], $opts_data, $selected_id, $this->input_action_identifier, $this->ACTION); //when there will be an onchange event, it will submit the current form.
- $default_value : null = null
-
(optional) : the value of the option to be selected by default on the first display
- $submit_varname : string = ''
- $submit_varvalue : string = ''
Return values
object —Html input select
set_attribute()
Sets an HTML attribute for the element.
public set_attribute(string $name, mixed $value) : voidParameters
- $name : string
-
The name of the attribute.
- $value : mixed
-
The value of the attribute.
set_extra()
Sets an extra property for the element.
public set_extra(string $name, mixed $value) : voidParameters
- $name : string
-
The name of the extra property.
- $value : mixed
-
The value of the extra property.
simple_data_grid()
Create quickly a datagrid (with a simple table tag) from a simple key=>value array.
public static simple_data_grid(array<string|int, mixed> $liste[, array<string|int, mixed> $columns_filter = null ][, string $id = false ]) : Objetit can come from DB\prepared_query_list or DB\query_list to display directy the result of a mysql Query. $columns_filter contains an array used to specify fields to display and to give them a display label. it can also change their order : exemple : $columns = Â ['id'=>'DB ID' , 'email'=>'mail adress ' , etc ... ] $liste = 0 => ['email'=>'xxx@yyyyy.com','id'=>125, ...], 1 => ['email'=>'zzzz@yyyyy.com','id'=>126, ...]
Parameters
- $liste : array<string|int, mixed>
- $columns_filter : array<string|int, mixed> = null
- $id : string = false
-
for the grid
Return values
Objet —Html table
SOURCE()
public static SOURCE([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlspan()
public static span([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlSPAN()
public static SPAN([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlSTYLE()
public static STYLE([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlsubmit_button()
Doing more than a simple submit button.
public static submit_button(mixed $attributes[, string $label = 'SUBMIT' ][, string $custom_submit_function = '' ]) : objectit use a token system to avoid flooding and limit ddos it will call validator to check the vallue of all input again. if we give an action identifier as name for all submit button, its value can be used to call different process (you'll see that during module construction). Exemple : $btn_delete = H::submit_button(['class'=>$this->css.'btn_del', 'name'=>$this->input_action_identifier, 'value'=>$this->ACTION_DELETE_document_data, 'title'=>$this->get_tl('tlc_del'), 'data-confirm'=>$this->get_tl('ask_delete')], $this->get_tl('tlc_del'));
Parameters
- $attributes : mixed
- $label : string = 'SUBMIT'
- $custom_submit_function : string = ''
-
a javascript call back called
Return values
object —Html submit button
submit_button_single()
seems to work just like a submit button only this field will be posted (in addition to all those with the 'alwaysposted' flag)
public static submit_button_single(mixed $attributes[, string $label = 'SUBMIT' ][, string $custom_submit_function = '' ]) : objectParameters
- $attributes : mixed
- $label : string = 'SUBMIT'
- $custom_submit_function : string = ''
Return values
object —Html submit button
SUMMARY()
public static SUMMARY([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlSVG()
public static SVG([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmltable()
public static table([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlTABLE()
public static TABLE([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmltable_header_row()
shortcut for _table_row
public static table_header_row(mixed $data_line[, mixed $columns_filter = null ][, mixed $values_filter = null ]) : mixedParameters
- $data_line : mixed
- $columns_filter : mixed = null
- $values_filter : mixed = null
Tags
- see
- _table_row()
table_row()
shortcut for _table_row
public static table_row(mixed $data_line[, mixed $columns_filter = null ][, mixed $values_filter = null ]) : mixedParameters
- $data_line : mixed
- $columns_filter : mixed = null
- $values_filter : mixed = null
Tags
- see
- _table_row()
tabs()
Create tabs inside a page or modal, useful to avoid to rely on navigator tabs.
public static tabs(array<string|int, mixed> $params, array<string|int, mixed> $labels, array<string|int, mixed> $contents) : HtmlTake a look in admin blockeditor or document editor to see exemple of usage
Parameters
- $params : array<string|int, mixed>
-
usual attributes
- $labels : array<string|int, mixed>
-
the tab labels
- $contents : array<string|int, mixed>
-
the tabl contents
Return values
Html —object tabs
tag()
Create a new Html instance for a tag
public static tag([string $tag_name = '' ][, null $attributes = null ][, null $content = null ]) : InstanceParameters
- $tag_name : string = ''
- $attributes : null = null
- $content : null = null
Return values
Instance —object
tbody()
public static tbody([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlTBODY()
public static TBODY([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmltd()
public static td([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlTD()
public static TD([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlTEXTAREA()
public static TEXTAREA([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmlth()
public static th([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlTH()
public static TH([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlTHEAD()
public static THEAD([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlTITLE()
public static TITLE([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
Htmltr()
public static tr([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlTR()
public static TR([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlUL()
public static UL([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlUSE()
public static USE([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlVIDEO()
public static VIDEO([array<string|int, mixed>|null $attrs = = 'null' ][, mixed $content = = 'null' ]) : HtmlParameters
- $attrs : array<string|int, mixed>|null = = 'null'
- $content : mixed = = 'null'
Return values
HtmlOn this page - Table Of Contents
- Constants
-
- _CHECKMARK_BOLD
- _CHECKMARK_NORMAL
- _DOWN_ARROW
- _DOWN_DASHED_ARROW
- _LEFT_ARROW
- _LEFT_DASHED_ARROW
- _RIGHT_ARROW
- _RIGHT_ARROW_HEAD
- _RIGHT_DASHED_ARROW
- _STAR_EMPTY
- _STAR_FULL
- _UP_ARROW
- _UP_DASHED_ARROW
- _X_BOLD
- _X_NORMAL
- A
- AUDIO
- BODY
- BR
- BUTTON
- CANVAS
- DATALIST
- DETAILS
- DIV
- FIELDSET
- FORM
- HEAD
- HR
- HTML
- IMAGE
- IMG
- INPUT
- LABEL
- LEGEND
- LI
- LINK
- META
- OPTGROUP
- OPTION
- PARAM
- QUICK_EDIT_DATA
- QUICK_EDIT_FIELD
- QUICK_EDIT_ID
- QUICK_EDIT_TYPE
- QUICK_EDIT_TYPE_INDEX
- SCRIPT
- SELECT
- simple_tags
- SOURCE
- SPAN
- STYLE
- SUMMARY
- SVG
- svg_sprite
- TABLE
- TBODY
- TD
- TEXTAREA
- TFOOT
- TH
- THEAD
- TITLE
- TR
- UL
- USE
- VIDEO
- Properties
- Methods
-
- __callStatic()
- __construct()
- __get()
- __set()
- __toString()
- __unset()
- _input_translation()
- _LEFT_DASHED_ARROW()
- _RIGHT_ARROW_HEAD()
- _RIGHT_DASHED_ARROW()
- a()
- A()
- add_after()
- add_child()
- add_class()
- add_debug()
- advanced_data_grid()
- after_html()
- ajax_call()
- alert()
- BODY()
- BR()
- button()
- BUTTON()
- button_icon()
- button_icon_with_text()
- button_info()
- CANVAS()
- close_document()
- close_html()
- close_tag()
- content_html()
- copy_attributes_to()
- create_instance()
- css_loader()
- del_attribute()
- detail()
- DETAILS()
- div()
- DIV()
- escape()
- FIELDSET()
- fieldset()
- find_child()
- FORM()
- form()
- full_html()
- get_children()
- get_items_after()
- get_unique_id()
- group()
- HEAD()
- HR()
- HTML()
- icon()
- image()
- IMG()
- input()
- INPUT()
- input_autocomplete()
- input_checkbox()
- input_colorpicker()
- input_confirmation()
- input_date()
- input_datetime()
- input_email()
- input_field()
- input_file()
- input_float()
- input_hidden()
- input_integer()
- input_login()
- input_multiple_radios()
- input_order()
- input_password()
- input_precomplete()
- input_radio()
- input_range()
- input_submit_attributes()
- input_text()
- input_textarea()
- input_time()
- is_simple()
- LABEL()
- label_tag()
- LEGEND()
- LI()
- LINK()
- load_js()
- META()
- multi_state_button()
- new_document()
- open_html_tag()
- open_tag()
- output()
- parse_event()
- preview_button()
- quick_edit()
- quick_edit_generate_input()
- reset_key()
- SCRIPT()
- script()
- script_loader()
- select()
- set_attribute()
- set_extra()
- simple_data_grid()
- SOURCE()
- span()
- SPAN()
- STYLE()
- submit_button()
- submit_button_single()
- SUMMARY()
- SVG()
- table()
- TABLE()
- table_header_row()
- table_row()
- tabs()
- tag()
- tbody()
- TBODY()
- td()
- TD()
- TEXTAREA()
- th()
- TH()
- THEAD()
- TITLE()
- tr()
- TR()
- UL()
- USE()
- VIDEO()
Search results