Skip to content
Snippets Groups Projects
Commit ce0f6cdb authored by Dave Greenberg's avatar Dave Greenberg
Browse files

Merge pull request #2243 from eileenmcnaughton/CRM-14021

CRM-14021 respect for .extra.hlp files & for alterations in help page vi...
parents 34403943 6eea17da
Branches
Tags
No related merge requests found
......@@ -41,6 +41,7 @@ class CRM_Core_Page_Inline_Help {
$args = $_REQUEST;
if (!empty($args['file']) && strpos($args['file'], '..') === FALSE) {
$file = $args['file'] . '.hlp';
$additionalTPLFile = $args['file'] . '.extra.hlp';
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('id', $args['id']);
CRM_Utils_Array::remove($args, 'file', 'class_name', 'type', 'q', 'id');
......@@ -48,7 +49,15 @@ class CRM_Core_Page_Inline_Help {
$arg = strip_tags($arg);
}
$smarty->assign('params', $args);
exit($smarty->fetch($file));
$extraoutput = '';
if ($smarty->template_exists($additionalTPLFile)) {
//@todo hook has been put here as a conservative approach
// but probably should always run. It doesn't run otherwise because of the exit
CRM_Utils_Hook::pageRun($this);
$extraoutput .= trim($smarty->fetch($additionalTPLFile));
}
exit($smarty->fetch($file) . $extraoutput);
}
}
}
......@@ -51,7 +51,7 @@ function smarty_function_help($params, &$smarty) {
$params['file'] = $smarty->_tpl_vars['tplFile'];
}
elseif (empty($params['file'])) {
return $help;
return NULL;
}
$params['file'] = str_replace(array('.tpl', '.hlp'), '', $params['file']);
......@@ -61,11 +61,16 @@ function smarty_function_help($params, &$smarty) {
$oldID = $smarty->get_template_vars('id');
$smarty->assign('id', $params['id'] . '-title');
$name = trim($smarty->fetch($params['file'] . '.hlp'));
$additionalTPLFile = $params['file'] . '.extra.hlp';
if ($smarty->template_exists($additionalTPLFile)) {
$name .= trim($smarty->fetch($additionalTPLFile));
}
$smarty->assign('id', $oldID);
}
else {
$name = trim(strip_tags($params['title']));
}
// Escape for html
$title = htmlspecialchars(ts('%1 Help', array(1 => $name)));
// Escape for html and js
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment