Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
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 | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | */ |
17 | ||
18 | /** | |
19 | * Grab the button type from a passed button element 'name' by checking for reserved QF button type strings | |
20 | * | |
c490a46a | 21 | * @param string $btnName |
6a488035 | 22 | * |
a6c01b45 | 23 | * @return string |
353ffa53 | 24 | * button type, one of: 'upload', 'next', 'back', 'cancel', 'refresh' |
6a488035 | 25 | * 'submit', 'done', 'display', 'jump' 'process' |
6a488035 TO |
26 | */ |
27 | function smarty_modifier_crmBtnType($btnName) { | |
28 | // split the string into 5 or more | |
29 | // button name are typically: '_qf_Contact_refresh' OR '_qf_Contact_refresh_dedupe' | |
30 | // button type is always the 3rd element | |
31 | // note the first _ | |
32 | $substr = CRM_Utils_System::explode('_', $btnName, 5); | |
33 | ||
34 | return $substr[3]; | |
35 | } |