commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / CRM / Core / Smarty / plugins / block.crmScope.php
1 <?php
2
3 /**
4 * Smarty block function to temporarily define variables.
5 *
6 * Example:
7 *
8 * @code
9 * {tsScope x=1}
10 * Expect {$x}==1
11 * {tsScope x=2}
12 * Expect {$x}==2
13 * {/tsScope}
14 * Expect {$x}==1
15 * {/tsScope}
16 * @endcode
17 *
18 * @param array $params
19 * Must define 'name'.
20 * @param string $content
21 * Default content.
22 * @param CRM_Core_Smarty $smarty
23 * The Smarty object.
24 *
25 * @param $repeat
26 *
27 * @return string
28 */
29 function smarty_block_crmScope($params, $content, &$smarty, &$repeat) {
30 /** @var CRM_Core_Smarty $smarty */
31
32 if ($repeat) {
33 // open crmScope
34 $smarty->pushScope($params);
35 }
36 else {
37 // close crmScope
38 $smarty->popScope();
39 }
40
41 return $content;
42 }