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 | * CiviCRM's Smarty edit-block plugin | |
14 | * | |
15 | * Template elements tagged {edit}...{/edit} are hidden unless action is create | |
16 | * or update (this facilitates using form templates for read-only display). | |
17 | * | |
18 | * @package CRM | |
19 | * @author Piotr Szotkowski <shot@caltha.pl> | |
20 | * @author Michal Mach <mover@artnet.org> | |
ca5cec67 | 21 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
22 | */ |
23 | ||
24 | /** | |
25 | * Smarty block function providing edit-only display support | |
26 | * | |
6a0b768e TO |
27 | * @param array $params |
28 | * Template call's parameters. | |
29 | * @param string $text | |
30 | * {edit} block contents from the template. | |
16b10e64 | 31 | * @param CRM_Core_Smarty $smarty |
6a0b768e | 32 | * The Smarty object. |
6a488035 | 33 | * |
a6c01b45 | 34 | * @return string |
353ffa53 | 35 | * the string, translated by gettext |
6a488035 TO |
36 | */ |
37 | function smarty_block_edit($params, $text, &$smarty) { | |
38 | $action = $smarty->_tpl_vars['action']; | |
39 | return ($action & 3) ? $text : NULL; | |
40 | } |