From 23d7e1c120e1cd212d9b093880788e06723a7d5d Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 20 Jan 2019 16:49:05 -0500 Subject: [PATCH] Allow help text to be overridden from an .extra.hlp file --- CRM/Core/Page/Inline/Help.php | 7 ++++++- CRM/Core/Smarty/plugins/block.htxt.php | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CRM/Core/Page/Inline/Help.php b/CRM/Core/Page/Inline/Help.php index 23f9cf1212..24938836b0 100644 --- a/CRM/Core/Page/Inline/Help.php +++ b/CRM/Core/Page/Inline/Help.php @@ -49,14 +49,19 @@ class CRM_Core_Page_Inline_Help { } $smarty->assign('params', $args); + $output = $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)); + // Allow override param to replace default text e.g. {hlp id='foo' override=1} + if ($smarty->get_template_vars('override_help_text')) { + $output = ''; + } } - exit($smarty->fetch($file) . $extraoutput); + exit($output . $extraoutput); } } diff --git a/CRM/Core/Smarty/plugins/block.htxt.php b/CRM/Core/Smarty/plugins/block.htxt.php index f4ae2ea53d..be78a1d86f 100644 --- a/CRM/Core/Smarty/plugins/block.htxt.php +++ b/CRM/Core/Smarty/plugins/block.htxt.php @@ -48,8 +48,8 @@ * the string, translated by gettext */ function smarty_block_htxt($params, $text, &$smarty) { - $id = $params['id']; - if ($id == $smarty->_tpl_vars['id']) { + if ($params['id'] == $smarty->_tpl_vars['id']) { + $smarty->assign('override_help_text', !empty($params['override'])); return $text; } else { -- 2.25.1