From 9cd2dac2982dc10986bd832b4795bdd16784c623 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 1 Nov 2018 14:57:37 +1300 Subject: [PATCH] Extract sharable portion of basicForm to basicFormFields. This is part of disentangling the invoicing mess out of the shared code --- templates/CRM/Form/basicForm.tpl | 27 +------------ templates/CRM/Form/basicFormFields.tpl | 53 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 26 deletions(-) create mode 100644 templates/CRM/Form/basicFormFields.tpl diff --git a/templates/CRM/Form/basicForm.tpl b/templates/CRM/Form/basicForm.tpl index 7b25c00a91..e8c963bb9f 100644 --- a/templates/CRM/Form/basicForm.tpl +++ b/templates/CRM/Form/basicForm.tpl @@ -53,33 +53,8 @@ {/foreach} {/if} - - {foreach from=$fields item=field key=fieldName} - {assign var=n value=$fieldName} - {if $form.$n} - - {if $field.html_type EQ 'checkbox'|| $field.html_type EQ 'checkboxes'} - - - {else} - - - {/if} - - {/if} - {/foreach} -
- {$form.$n.html} - {if $field.description} -
{$field.description} - {/if} -
{$form.$n.label} - {$form.$n.html} - {if $field.description} -
{$field.description} - {/if} -
+ {include file="CRM/Form/basicFormFields.tpl"}
{include file="CRM/common/formButtons.tpl" location="bottom"}
{if $formName == "Contribute_Preferences"} diff --git a/templates/CRM/Form/basicFormFields.tpl b/templates/CRM/Form/basicFormFields.tpl new file mode 100644 index 0000000000..d5d292b8d9 --- /dev/null +++ b/templates/CRM/Form/basicFormFields.tpl @@ -0,0 +1,53 @@ +{* + +--------------------------------------------------------------------+ + | CiviCRM version 5 | + +--------------------------------------------------------------------+ + | Copyright CiviCRM LLC (c) 2004-2018 | + +--------------------------------------------------------------------+ + | This file is a part of CiviCRM. | + | | + | CiviCRM is free software; you can copy, modify, and distribute it | + | under the terms of the GNU Affero General Public License | + | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | + | | + | CiviCRM is distributed in the hope that it will be useful, but | + | WITHOUT ANY WARRANTY; without even the implied warranty of | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | + | See the GNU Affero General Public License for more details. | + | | + | You should have received a copy of the GNU Affero General Public | + | License and the CiviCRM Licensing Exception along | + | with this program; if not, contact CiviCRM LLC | + | at info[AT]civicrm[DOT]org. If you have questions about the | + | GNU Affero General Public License or the licensing of CiviCRM, | + | see the CiviCRM license FAQ at http://civicrm.org/licensing | + +--------------------------------------------------------------------+ +*} +{* @todo the invoicing_blocks id is used by contribution preferences - get that out of the shared code & back to where it belongs *} +{* @todo with a small amount of tinkering most of this can be replaced by re-using the foreach loop in CRM_Core_EntityForm.tpl *} + + {foreach from=$fields item=field key=fieldName} + {assign var=n value=$fieldName} + {if $form.$n} + + {if $field.html_type EQ 'checkbox'|| $field.html_type EQ 'checkboxes'} + + + {else} + + + {/if} + + {/if} + {/foreach} +
+ {$form.$n.html} + {if $field.description} +
{$field.description} + {/if} +
{$form.$n.label} + {$form.$n.html} + {if $field.description} +
{$field.description} + {/if} +
-- 2.25.1