JHtml is utility class for all HTML drawing classes. The _ method of JHtml is a static function that grants quick access to a number of other static methods. The return value of this function depends on the return value of the method resolved by parsing the first parameter.
JHtml::_() expects its first parameter to be a string of period-separated (dot-separated) values. These values represent a class prefix (optional), a file name, and a method, in that order.
When only a filename and method are provided, the prefix defaults to "JHtml" and the resolved class name will consist of "JHtml<filename>." For example,
echo JHtml::_('form.token');
The above code will output the return value of JHtmlForm::token, found in
/libraries/cms/html/form.php
The filename is used to find the file in which the class and method are defined among whatever include paths have been attached to the static JHtml class using JHtml::addIncludePath.
The "/libraries/cms/html" folder is attached to the JHtml class by default.
Example:
echo JHtml::_('myExtension.button.submit');
The above code will output the return value of a static method, myExtensionButton::submit, which should be defined in a file called "button.php," provided that this file exists in the default include path.
Additional Parameters
Any additional parameters passed to JHtml::_() are passed as parameters themselves to the resolved method.
Files or Classes in JHtml
You can check these files in the folder:
/libraries/cms/html
- Access
- ActionsDropdown
- AdminLanguage
- Batch
- Behaviour
- Bootstrap
- Category
- Content
- ContentLanguage
- Date
- Debug
- Dropdown
- Form
- Formbehavior
- Grid
- Icons
- JGrid
- JQuery
- Links
- List
- Menu
- Number
- Rules
- Searchtools
- Select
- Sidebar
- Sliders
- SortableList
- String
- Tabs
- Tag
- Tel