Back to HTMLHelper class

Method register

public static bool
register
(mixed $key, callable $function)
Registers a function to be called with a specific key
Parameters
  • string $key The name of the key
  • callable $function Function or method
Returns
  • bool True if the function is callable
Since
  • 1.6
Deprecated
  • 5.0
Class: HTMLHelper
Project: Joomla

Method register - Source code

/**
 * Registers a function to be called with a specific key
 *
 * @param   string    $key       The name of the key
 * @param   callable  $function  Function or method
 *
 * @return  boolean  True if the function is callable
 *
 * @since       1.6
 * @deprecated  5.0 Use the service registry instead
 */
public static function register($key, callable $function)
{
    @trigger_error('Support for registering functions is deprecated and will be removed in Joomla 5.0, use the service registry instead', E_USER_DEPRECATED);
    list($key) = static::extract($key);
    static::$registry[$key] = $function;
    return true;
}