class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPage {
/**
- * store membership price set id
+ * Store membership price set id
*/
protected $_memPriceSetId = NULL;
/**
- * This function sets the default values for the form. Note that in edit/view mode
+ * Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @access public
$this->_memPriceSetId = $priceSetId;
$pFIDs = array();
if ($priceSetId) {
- CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = array('html_type', 'name'));
+ CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = array('html_type', 'name', 'label'));
foreach ($pFIDs as $pid => $pValue) {
if ($pValue['html_type'] == 'Radio' && $pValue['name'] == 'membership_amount') {
$defaults['mem_price_field_id'] = $pValue['id'];
+ $defaults['membership_type_label'] = $pValue['label'];
}
}
}
/**
- * Function to actually build the form
+ * Build the form object
*
* @return void
* @access public
$this->addElement('checkbox', 'is_required', ts('Require Membership Signup'));
$this->addElement('checkbox', 'display_min_fee', ts('Display Membership Fee'));
$this->addElement('checkbox', 'is_separate_payment', ts('Separate Membership Payment'));
+ $this->addElement('text', 'membership_type_label', ts('Membership Types Label'), array('placeholder' => ts('Membership')));
$paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1');
$paymentProcessorIds = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage',
}
/**
- * Function for validation
+ * Validation
*
* @param array $params (ref.) an assoc array of name/value pairs
*
* @param $files
- * @param null $contributionPageId
+ * @param int $contributionPageId
*
* @return mixed true or array of errors
* @access public
CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults);
if (empty($editedResults['id'])) {
$fieldParams['name'] = strtolower(CRM_Utils_String::munge('Membership Amount', '_', 245));
- $fieldParams['label'] = !empty($params['new_title']) ? $params['new_title'] : ts('Membership');
if (empty($params['mem_price_field_id'])) {
CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceField', 0, 1, array('price_set_id' => $priceSetID));
}
$fieldParams['id'] = CRM_Utils_Array::value('id', $editedResults);
}
+ $fieldParams['label'] = !empty($params['membership_type_label']) ? $params['membership_type_label'] : ts('Membership');
$fieldParams['is_active'] = 1;
$fieldParams['html_type'] = 'Radio';
$fieldParams['is_required'] = !empty($params['is_required']) ? 1 : 0;