$this->_allowWaitlist = FALSE;
if ($eventFull && !$this->_allowConfirmation && !empty($this->_values['event']['has_waitlist'])) {
$this->_allowWaitlist = TRUE;
- $this->_waitlistMsg = CRM_Utils_Array::value('waitlist_text', $this->_values['event']);
+ $this->_waitlistMsg = $this->_values['event']['waitlist_text'] ?? NULL;
if (!$this->_waitlistMsg) {
$this->_waitlistMsg = ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.');
}
}
if ($this->_values['event']['is_monetary']) {
- if (count($pps) > 1) {
- $this->addRadio('payment_processor_id', ts('Payment Method'), $pps,
- NULL, " "
- );
- }
- elseif (!empty($pps)) {
- $ppKeys = array_keys($pps);
- $currentPP = array_pop($ppKeys);
- $this->addElement('hidden', 'payment_processor_id', $currentPP);
- }
+ $this->addPaymentProcessorFieldsToForm();
}
$this->addElement('hidden', 'bypass_payment', NULL, ['id' => 'bypass_payment']);
// CRM-11182 - Optional confirmation screen
// Change button label depending on whether the next action is confirm or register
+ $buttonParams = [
+ 'type' => 'upload',
+ 'spacing' => ' ',
+ 'isDefault' => TRUE,
+ ];
if (
!$this->_values['event']['is_multiple_registrations']
&& !$this->_values['event']['is_monetary']
&& !$this->_values['event']['is_confirm_enabled']
) {
- $buttonLabel = ts('Register');
+ $buttonParams['name'] = ts('Register');
}
else {
- $buttonLabel = ts('Continue');
+ $buttonParams['name'] = ts('Review your registration');
+ $buttonParams['icon'] = 'fa-chevron-right';
}
- $this->addButtons([
- [
- 'type' => 'upload',
- 'name' => $buttonLabel,
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ],
- ]);
+ $this->addButtons([$buttonParams]);
}
$this->addFormRule(['CRM_Event_Form_Registration_Register', 'formRule'], $this);
//if payment done, no need to build the fee block.
if (!empty($form->_paymentId)) {
//fix to display line item in update mode.
- $form->assign('priceSet', isset($form->_priceSet) ? $form->_priceSet : NULL);
+ $form->assign('priceSet', $form->_priceSet ?? NULL);
return;
}
- $feeFields = CRM_Utils_Array::value('fee', $form->_values);
+ $feeFields = $form->_values['fee'] ?? NULL;
if (is_array($feeFields)) {
$form->_feeBlock = &$form->_values['fee'];
}
//check for discount.
- $discountedFee = CRM_Utils_Array::value('discount', $form->_values);
+ $discountedFee = $form->_values['discount'] ?? NULL;
if (is_array($discountedFee) && !empty($discountedFee)) {
if (!$discountId) {
$form->_discountId = $discountId = CRM_Core_BAO_Discount::findSet($form->_eventId, 'civicrm_event');
$fieldId = $field['id'];
$elementName = 'price_' . $fieldId;
- $isRequire = CRM_Utils_Array::value('is_required', $field);
+ $isRequire = $field['is_required'] ?? NULL;
if ($button == 'skip') {
$isRequire = FALSE;
}
//user might modified w/ hook.
- $options = CRM_Utils_Array::value('options', $field);
+ $options = $field['options'] ?? NULL;
$formClasses = ['CRM_Event_Form_Participant', 'CRM_Event_Form_ParticipantFeeSelection'];
if (!is_array($options)) {
}
$form->assign('eventFeeBlockValues', json_encode($eventFeeBlockValues));
- $form->_defaults['amount'] = CRM_Utils_Array::value('default_fee_id', $form->_values['event']);
+ $form->_defaults['amount'] = $form->_values['event']['default_fee_id'] ?? NULL;
$element = &$form->addGroup($elements, 'amount', ts('Event Fee(s)'), '<br />');
if (isset($form->_online) && $form->_online) {
$element->freeze();
$skipParticipants = $formattedPriceSetDefaults = [];
if (!empty($form->_allowConfirmation) && (isset($form->_pId) || isset($form->_additionalParticipantId))) {
- $participantId = isset($form->_pId) ? $form->_pId : $form->_additionalParticipantId;
+ $participantId = $form->_pId ?? $form->_additionalParticipantId;
$pricesetDefaults = CRM_Event_Form_EventFees::setDefaultPriceSet($participantId,
$form->_eventId
);
$params['campaign_id'] = $params['participant_campaign_id'];
}
else {
- $params['campaign_id'] = CRM_Utils_Array::value('campaign_id', $this->_values['event']);
+ $params['campaign_id'] = $this->_values['event']['campaign_id'] ?? NULL;
}
//hack to allow group to register w/ waiting