Helpers
Helpers are just global functions that are availble through modules and are easy to use in views.
The Quantum framework comes with several usuful predefined helper functions.
qt_instance()
- Returns Quantum controller instanceview()
- Returns rendered viewget_current_module()
- Returns current modulecurrent_controller()
- Returns current controllercurrent_action()
- Returns current actionsession()
- Facade toSessionManager
(will be covered in sessions section)redirect($url, $code = NULL)
- Redirects to given the`$url`
get_referrer()
- Returns the referrercurrent_url()
- Returns the current urlbase_dir()
- Returns the path of base directorypublic_dir()
- Returns the path of public directoryuploads_dir()
- Returns the path of public directorybase_url()
- Returns the base URLget_config($key)
- Returns the the config value by the given`$key`
slugify($text)
- Normalize and pretify the string for urls and pathsget_user_ip()
- Returns the remote IPout($var, $die = false)
- Outputs the dump of the given`$var`
env($var, $default = false)
- Returns the environment variable by given`$var`
csrf_token()
- Returns the CSRF token (will be covered in CSRF section)_t()
- Outputs the translated textt()
- Returns the translated text
You are free to define your own custom functions in function.php under base helpers directory and the framework will load them.
It's possible to load helpers from other places with load($path = BASE_DIR)
method of Helpers class by passing the path of the helpers directory.