From c41292e80afabd57e4a0da439b6a85f457c2d5d1 Mon Sep 17 00:00:00 2001 From: eileen Date: Sun, 29 Jul 2018 16:25:36 +1200 Subject: [PATCH] Convert 'name' & 'description' to use the entity Fields format. Note that doing a partial conversion in the template is just a stepping stone to using the EntityField template, when lots of fields need conversion / review it allows us to break it up Simplify converstion of fields, convert 2 more --- CRM/Member/Form/MembershipType.php | 8 +++-- templates/CRM/Member/Form/MembershipType.tpl | 34 ++++---------------- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/CRM/Member/Form/MembershipType.php b/CRM/Member/Form/MembershipType.php index fb0a75cc08..a9ac197f11 100644 --- a/CRM/Member/Form/MembershipType.php +++ b/CRM/Member/Form/MembershipType.php @@ -244,10 +244,12 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form_MembershipConfig { if ($this->_action & CRM_Core_Action::DELETE) { return; } + // This is a temporary variable as we work towards moving over towards using the EntityField.tpl. + // Fields in this array have been tested & in the tpl have been switched over to metadata. + // Note this kinda 'works from the top' - ie. once we hit a field that needs some thought we need + // to stop & make that one work. + $this->assign('tpl_standardised_fields', ['name', 'description', 'member_of_contact_id', 'minimum_fee']); - $this->applyFilter('__ALL__', 'trim'); - $this->addField('name', [], TRUE); - $this->addField('description'); $this->addField('minimum_fee'); $this->addField('duration_unit', [], TRUE); $this->addField('period_type', [], TRUE); diff --git a/templates/CRM/Member/Form/MembershipType.tpl b/templates/CRM/Member/Form/MembershipType.tpl index b9eabe5238..2fee1d3655 100644 --- a/templates/CRM/Member/Form/MembershipType.tpl +++ b/templates/CRM/Member/Form/MembershipType.tpl @@ -32,34 +32,12 @@
{include file="CRM/common/formButtons.tpl" location="top"}
- - - - - - - - - - - - - - - - - - + {foreach from=$tpl_standardised_fields item=fieldName} + {assign var=fieldSpec value=$entityFields.$fieldName} + + {include file="CRM/Core/Form/Field.tpl"} + + {/foreach}
{$form.name.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_type' field='name' id=$membershipTypeId}{/if} - {$form.name.html}
- {ts}e.g. 'Student', 'Senior', 'Honor Society'...{/ts} -
{$form.description.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_type' field='description' id=$membershipTypeId}{/if} - {$form.description.html}
- {ts}Description of this membership type for internal use. May include eligibility, benefits, terms, etc.{/ts} -
{$form.member_of_contact_id.label}{$form.member_of_contact_id.html}
- {ts}Members assigned this membership type belong to which organization (e.g. this is for membership in 'Save the Whales - Northwest Chapter'). NOTE: This organization/group/chapter must exist as a CiviCRM Organization type contact.{/ts} -
{$form.minimum_fee.label}{$form.minimum_fee.html|crmMoney}
- {ts}Minimum fee required for this membership type. For free/complimentary memberships - set minimum fee to zero (0). NOTE: When using CiviCRM to process sales taxes this should be the tax exclusive amount.{/ts} -
{$form.financial_type_id.label} {$form.financial_type_id.html}
-- 2.25.1