Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
1188c7a8 | 3 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 4 | | | |
1188c7a8 TO |
5 | | This work is published under the GNU AGPLv3 license with some | |
6 | | permitted exceptions and without any warranty. For full license | | |
7 | | and copyright information, see https://civicrm.org/licensing | | |
6a488035 TO |
8 | +--------------------------------------------------------------------+ |
9 | *} | |
10 | ||
dbdc5c34 | 11 | {crmRegion name='form-buttons'} |
7bf3b68c MWMC |
12 | {* Loops through $linkButtons and assigns html "a" (link) buttons to the template. Used for additional entity functions such as "Move to Case" or "Renew Membership" *} |
13 | {if $linkButtons} | |
14 | {foreach from=$linkButtons item=linkButton} | |
15 | {if $linkButton.accesskey} | |
16 | {capture assign=accessKey}accesskey="{$linkButton.accessKey}"{/capture} | |
17 | {else}{assign var="accessKey" value=""} | |
18 | {/if} | |
19 | {if $linkButton.icon} | |
20 | {capture assign=icon}<i class="crm-i {$linkButton.icon}"></i> {/capture} | |
21 | {else}{assign var="icon" value=""} | |
22 | {/if} | |
23 | {if $linkButton.ref} | |
24 | {capture assign=linkname}name="{$linkButton.ref}"{/capture} | |
25 | {else}{capture assign=linkname}name="{$linkButton.name}"{/capture} | |
26 | {/if} | |
27 | <a class="button" {$linkname} href="{crmURL p=$linkButton.url q=$linkButton.qs}" {$accessKey} {$linkButton.extra}><span>{$icon}{$linkButton.title}</span></a> | |
28 | {/foreach} | |
29 | {/if} | |
30 | ||
31 | {* Loops through $form.buttons.html array and assigns separate spans with classes to allow theming by button and name. | |
32 | * crmBtnType grabs type keyword from button name (e.g. 'upload', 'next', 'back', 'cancel') so types of buttons can be styled differently via css. | |
33 | *} | |
029e030d MWMC |
34 | {foreach from=$form.buttons item=button key=key name=btns} |
35 | {if $key|substring:0:4 EQ '_qf_'} | |
36 | {if $location} | |
37 | {assign var='html' value=$form.buttons.$key.html|crmReplace:id:"$key-$location"} | |
38 | {else} | |
39 | {assign var='html' value=$form.buttons.$key.html} | |
6a488035 | 40 | {/if} |
029e030d MWMC |
41 | {crmGetAttribute html=$html attr='crm-icon' assign='icon'} |
42 | {capture assign=iconPrefix}{$icon|truncate:3:"":true}{/capture} | |
43 | {if $icon && $iconPrefix eq 'fa-'} | |
44 | {assign var='buttonClass' value=' crm-i-button'} | |
45 | {capture assign=iconDisp}<i class="crm-i {$icon}"></i>{/capture} | |
46 | {elseif $icon} | |
47 | {assign var='buttonClass' value=' crm-icon-button'} | |
48 | {capture assign=iconDisp}<span class="crm-button-icon ui-icon-{$icon}"> </span>{/capture} | |
49 | {/if} | |
50 | {crmGetAttribute html=$html attr='disabled' assign='disabled'} | |
51 | <span class="crm-button crm-button-type-{$key|crmBtnType} crm-button{$key}{$buttonClass}{if $disabled} crm-button-disabled{/if}"{if $buttonStyle} style="{$buttonStyle}"{/if}> | |
52 | {$iconDisp} | |
53 | {$html} | |
54 | </span> | |
55 | {/if} | |
56 | {/foreach} | |
dbdc5c34 | 57 | {/crmRegion} |