tform.ftl
1 <#-- Macro: tform
2
3 Description: Generates a Bootstrap form element with specified properties.
4
5 Parameters:
6 - type (string, optional): the type of form (horizontal, inline, or blank).
7 - class (string, optional): additional CSS classes to add to the form element.
8 - align (string, optional): the alignment of the form element (left, right, or center).
9 - hide (list, optional): a list of form properties to hide.
10 - action (string, optional): the URL to submit the form to.
11 - method (string, optional): the HTTP method to use when submitting the form (get or post).
12 - name (string, optional): the name of the form element.
13 - id (string, optional): the ID of the form element.
14 - role (string, optional): the role of the form element.
15 - collapsed (boolean, optional): whether to collapse the form element.
16 - enctype (string, optional): the encoding type for the form element.
17 - params (string, optional): additional parameters to add to the form element.
18
19 -->
20 <#macro tform type='' class='' align='' hide=[] action='' required=false method='post' name='' id='' role='' collapsed=false enctype='' boxed=false boxClass='' params='' deprecated...>
21 <@deprecatedWarning args=deprecated />
22 <#local class = class />
23 <#if align!=''><#local class += ' ' + alignmentSettings(align,'') /></#if>
24 <#if hide??>
25 <#if type == 'inline'>
26 <#local class += ' ' + displaySettings(hide,'inline-flex') />
27 <#else>
28 <#local class += ' ' + displaySettings(hide,'block') />
29 </#if>
30 </#if>
31 <#if collapsed><#local class += ' collapse' /></#if>
32 <#switch type>
33 <#case 'horizontal'>
34 <#local class += ''>
35 <#break>
36 <#case 'inline'>
37 <#local class += ' d-inline-flex align-items-center'>
38 <#break>
39 <#case 'flex'>
40 <#local class += ' d-flex align-items-center'>
41 <#break>
42 <#default>
43 <#local class += ''>
44 </#switch>
45 <#if boxed>
46 <div class="card<#if boxClass !=''> ${boxClass!}</#if>">
47 <div class="card-body"></#if>
48 <form <#if class!=''>class="${class?trim} <#if align='middle'>align-middle</#if>"</#if><#if id!=''> id="${id}"</#if><#if action!=''> action="${action}"</#if><#if method!=''> method="${method}"</#if><#if name!=''> name="${name}"</#if><#if role!=''> role="${role}"</#if><#if method='post' && enctype!=''> enctype='${enctype}'</#if><#if params!=''> ${params}</#if>>
49 <#if required><@staticText>#i18n{portal.util.message.titleRequiredFields}</@staticText></#if>
50 <#nested>
51 </form>
52 <#if boxed>
53 </div>
54 </div></#if>
55 </#macro>