Joomla HTMLHelper::_ Class Loader Method

The HTMLHelper is utility class for all HTML drawing classes. The _() method of HTMLHelper 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.

The HTMLHelper:_() 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.

Namespace:

use Joomla\CMS\HTML\HTMLHelper;

For example,

echo HTMLHelper::_('form.token');

The above code will output the return value of token(), found in the folder:

/libraries/src/HTML/Helpers/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 HTMLHelper class using HTMLHelper::addIncludePath.

The "/libraries/src/HTML/Helpers" folder is attached to the class by default.

Example:

echo HTMLHelper::_('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 HTMLHelper::_() are passed as parameters themselves to the resolved method.

Files or Classes in HTMLHelper

You can check these files in the folder: /libraries/src/HTML/Helpers

Content

It is utility class to fire onContentPrepare for non-article based content.

  1. HTMLHelper::_('content.prepare', $text);

Date

It is an extended Utility class for handling date display.

  1. HTMLHelper::_('date.relative', $date);

Email

It is utility class for cloaking email addresses.

  1. HTMLHelper::_('email.cloak', $mail);

Form

  1. HTMLHelper::_('form.token');

Links

  1. HTMLHelper::_('links.link', $link);

List

It is utility class for creating different select lists.

  1. HTMLHelper::_('list.images', $name);
  2. HTMLHelper::_('list.positions', $name);

Menu

It is utility class working with menu select lists.

  1. HTMLHelper::_('menu.menus');
  2. HTMLHelper::_('menu.menuItems');
  3. HTMLHelper::_('menu.menuItemList', $name);

Select

It is utility class for creating HTML select lists.

  1. HTMLHelper::_('select.booleanlist', $name);
  2. HTMLHelper::_('select.genericlist', $data, $name);
  3. HTMLHelper::_('select.integerlist', $start, $end, $inc, $name);
  4. HTMLHelper::_('select.radiolist', $data, $name);
  5. HTMLHelper::_('select.option', $value, $text = '');
  6. HTMLHelper::_('select.options', $arr);

StringHelper

  1. HTMLHelper::_('string.truncate', $text, $length);

Tag

It is utility class for tags.

  1. HTMLHelper::_('tag.tags');

User

It is utility class working with users.

  1. HTMLHelper::_('user.groups');
  2. HTMLHelper::_('user.userlist');