Merge branch 'maint/7.0'
[ninja.git] / application / helpers / help.php
blobdb0c95f70c3113490ffe0eb9882b3d71d0a93659
1 <?php defined('SYSPATH') OR die('No direct access allowed.');
2 /**
3 * Help class to provide links to render help texts
4 */
5 class help
7 /**
8 * Render the help text calls to fetch
9 * translated help texts vis ajax calls.
11 * Example usage:
12 * Entering <?php help::render('edit'); ?> somewhere on a page (view) will
13 * create a clickable icon that fetches the help text from the current
14 * controller.
16 * By adding a second parameter to the call:
17 * <?php help::render('edit', 'extinfo'); ?> the information is instead
18 * fetched from the extinfo controller.
20 public static function render($key=false, $controller=false)
22 if (empty($key)) {
23 return false;
26 $img_path = url::base(false).'application/views/icons/12x12/help.png';
28 $controller = !empty($controller) ? $controller : Router::$controller;
30 return '<a class="helptext_target" style="border:0" data-helptext-controller="'.$controller.'" data-helptext-key="'.$key.'" href="#">'.
31 '<img src="'.$img_path.'" alt="'._('Click for help').'" style="width: 12px; height: 12px; margin-bottom: -1px" /></a>';