From c74548483d8f3abed985d774a96fa1ca49bc7954 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 20 Jan 2015 14:05:04 -0500 Subject: [PATCH] CRM-15789 - Add helper function for button markup ---------------------------------------- * CRM-15789: Add icons to submit buttons https://issues.civicrm.org/jira/browse/CRM-15789 --- CRM/Core/Smarty/plugins/block.crmButton.php | 62 +++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 CRM/Core/Smarty/plugins/block.crmButton.php diff --git a/CRM/Core/Smarty/plugins/block.crmButton.php b/CRM/Core/Smarty/plugins/block.crmButton.php new file mode 100644 index 0000000000..55cb32ed6e --- /dev/null +++ b/CRM/Core/Smarty/plugins/block.crmButton.php @@ -0,0 +1,62 @@ + FALSE)); + // Always add class 'button' - fixme probably should be crm-button + $params['class'] = 'button ' . CRM_Utils_Array::value('class', $params, ''); + // Any jQuery-UI icon works + $icon = CRM_Utils_Array::value('icon', $params, 'pencil'); + // All other params are treated as html attributes + CRM_Utils_Array::remove($params, 'icon', 'p', 'q', 'a', 'f', 'h', 'fb', 'fe'); + $attributes = smarty_function_crmAttributes(array('a' => $params), CRM_Core_DAO::$_nullObject); + return " $text"; +} -- 2.25.1