[#5] Add membership type configuration option in profile
This commit is contained in:
parent
4537ac540a
commit
341a0f0e32
3 changed files with 37 additions and 0 deletions
|
@ -224,6 +224,15 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
|||
array('class' => 'crm-select2 huge')
|
||||
);
|
||||
|
||||
$this->add(
|
||||
'select', // field type
|
||||
'membership_type_id', // field name
|
||||
E::ts('Create membership of type'), // field label
|
||||
array('' => E::ts('- none -')) + $this->getMembershipTypes(), // list of options
|
||||
FALSE, // is not required
|
||||
array('class' => 'crm-select2 huge')
|
||||
);
|
||||
|
||||
$this->add(
|
||||
'text', // field type
|
||||
'contribution_source', // field name
|
||||
|
@ -349,6 +358,27 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
|||
return $financial_types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves membership types present within the system as options for select
|
||||
* form elements.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \CiviCRM_API3_Exception
|
||||
*/
|
||||
public function getMembershipTypes() {
|
||||
$membership_types = array();
|
||||
$query = civicrm_api3('MembershipType', 'get', array(
|
||||
'is_active' => 1,
|
||||
'option.limit' => 0,
|
||||
'return' => 'id,name'
|
||||
));
|
||||
foreach ($query['values'] as $type) {
|
||||
$membership_types[$type['id']] = $type['name'];
|
||||
}
|
||||
return $membership_types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves campaigns present within the system as options for select form
|
||||
* elements.
|
||||
|
|
|
@ -191,6 +191,7 @@ class CRM_Twingle_Profile {
|
|||
'donation_receipt_groups',
|
||||
'campaign',
|
||||
'contribution_source',
|
||||
'membership_type_id',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -250,6 +251,7 @@ class CRM_Twingle_Profile {
|
|||
'donation_receipt_groups' => NULL,
|
||||
'campaign' => NULL,
|
||||
'contribution_source' => NULL,
|
||||
'membreship_type_id' => NULL,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -185,6 +185,11 @@
|
|||
<td class="content">{$form.campaign.html}</td>
|
||||
</tr>
|
||||
|
||||
<tr class="crm-section">
|
||||
<td class="label">{$form.membership_type_id.label}</td>
|
||||
<td class="content">{$form.membership_type_id.html}</td>
|
||||
</tr>
|
||||
|
||||
<tr class="crm-section">
|
||||
<td class="label">{$form.contribution_source.label}</td>
|
||||
<td class="content">{$form.contribution_source.html}</td>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue