summaryrefslogtreecommitdiff
path: root/smartyplugins/block.legend.php
blob: e0a250eba852fc19128d100a4c7c14ca6bbce6fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php 
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */

/**
 * Smarty {form} block plugin
 *
 * Type:     block
 * Name:     form
 * Input:
 *           - legend      (optional) - text that appears in the legend
 */
function smarty_block_legend($params, $content, &$gBitSmarty) {
	if( $content ) {
		$attributes = '';
		$attributes .= !empty( $params['class'] ) ? ' class="'.$params['class'].'" ' : '' ;
		$attributes .= !empty( $params['id'] ) ? ' id="'.$params['id'].'" ' : '' ;
		$ret = '<fieldset '.$attributes.'>';
		if( !empty( $params['legend'] ) ) {
			$ret .= '<legend>'.tra( $params['legend'] ).'</legend>';
		}
		$ret .= $content;
		$ret .= '</fieldset>';
		return $ret;
	}
}
?>