Merge pull request #14928 from lcdservices/dev-core-1158
[civicrm-core.git] / CRM / Core / Smarty / plugins / modifier.crmBtnType.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 * $Id$
17 *
18 */
19
20 /**
21 * Grab the button type from a passed button element 'name' by checking for reserved QF button type strings
22 *
23 * @param string $btnName
24 *
25 * @return string
26 * button type, one of: 'upload', 'next', 'back', 'cancel', 'refresh'
27 * 'submit', 'done', 'display', 'jump' 'process'
28 */
29 function smarty_modifier_crmBtnType($btnName) {
30 // split the string into 5 or more
31 // button name are typically: '_qf_Contact_refresh' OR '_qf_Contact_refresh_dedupe'
32 // button type is always the 3rd element
33 // note the first _
34 $substr = CRM_Utils_System::explode('_', $btnName, 5);
35
36 return $substr[3];
37 }