[#27] implementing campaign options
This commit is contained in:
parent
a8fef68799
commit
35cf2f80e2
6 changed files with 95 additions and 27 deletions
|
@ -357,12 +357,26 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
|||
$this->add(
|
||||
'select', // field type
|
||||
'campaign', // field name
|
||||
E::ts('Campaign (e.g. for donation)'), // field label
|
||||
E::ts('Default Campaign'), // field label
|
||||
array('' => E::ts('- none -')) + static::getCampaigns(), // list of options
|
||||
FALSE, // is not required
|
||||
array('class' => 'crm-select2 huge')
|
||||
);
|
||||
|
||||
$this->add(
|
||||
'select',
|
||||
'campaign_targets',
|
||||
E::ts('Set Campaign for'),
|
||||
[
|
||||
'contribution' => E::ts("Contribution"),
|
||||
'recurring' => E::ts("Recurring Contribution"),
|
||||
'membership' => E::ts("Membership"),
|
||||
'mandate' => E::ts("SEPA Mandate"),
|
||||
],
|
||||
FALSE, // is not required
|
||||
['class' => 'crm-select2 huge', 'multiple' => 'multiple']
|
||||
);
|
||||
|
||||
$this->add(
|
||||
'select', // field type
|
||||
'membership_type_id', // field name
|
||||
|
@ -511,9 +525,14 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
|||
$defaults = parent::setDefaultValues();
|
||||
if (in_array($this->_op, array('create', 'edit'))) {
|
||||
$defaults['name'] = $this->profile->getName();
|
||||
foreach ($this->profile->getData() as $element_name => $value) {
|
||||
$profile_data = $this->profile->getData();
|
||||
foreach ($profile_data as $element_name => $value) {
|
||||
$defaults[$element_name] = $value;
|
||||
}
|
||||
// backwards compatibility, see issue #27
|
||||
if (!isset($profile_data['campaign_targets'])) {
|
||||
$defaults['campaign_targets'] = ['contribution', 'contact'];
|
||||
}
|
||||
}
|
||||
return $defaults;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue