CRM_Contribute_Form_Contribution_Confirm
extends CRM_Contribute_Form_ContributionBase
in package
form to process actions on the group aspect of Custom Data
Table of Contents
Constants
- ATTR_SPACING = ' '
- Constants for attributes for various form elements attempt to standardize on the number of variations that we use of the below form elements
- CB_PREFIX = 'mark_x_'
- All checkboxes are defined with a common prefix. This allows us to have the same javascript to check / clear all the checkboxes etc If u have multiple groups of checkboxes, you will need to give them different ids to avoid potential name collision
- CB_PREFIX_LEN = 7
- All checkboxes are defined with a common prefix. This allows us to have the same javascript to check / clear all the checkboxes etc If u have multiple groups of checkboxes, you will need to give them different ids to avoid potential name collision
- CB_PREFIY = 'mark_y_'
- All checkboxes are defined with a common prefix. This allows us to have the same javascript to check / clear all the checkboxes etc If u have multiple groups of checkboxes, you will need to give them different ids to avoid potential name collision
- CB_PREFIZ = 'mark_z_'
- All checkboxes are defined with a common prefix. This allows us to have the same javascript to check / clear all the checkboxes etc If u have multiple groups of checkboxes, you will need to give them different ids to avoid potential name collision
Properties
- $_action : int
- (QUASI-PROTECTED) The mode of operation for this form
- $_amount : float
- Cache the amount to make things easier
- $_bltID : int
- The billing location id for this contribution page.
- $_ccid : int
- The contribution ID - is an option in the URL if you are making a payment against an existing contribution (an "invoice payment").
- $_contactID : int
- The id of the contact associated with this contribution.
- $_contributionID : int
- The id of the contribution object that is created when the form is submitted, or passed in.
- $_defaults : array<string|int, mixed>
- The default values for the form.
- $_emailExists : bool
- Flag if email field exists in embedded profile
- $_fields : array<string|int, mixed>
- The fields involved in this contribution page
- $_id : int
- The id of the contribution page that we are processing.
- $_isBillingAddressRequiredForPayLater : bool
- $_membershipBlock : array<string|int, mixed>
- The membership block for this page
- $_membershipContactID : int
- The contact id related to a membership
- $_membershipId : int
- The Membership ID for membership renewal
- $_mode : string
- The mode that we are in
- $_options : mixed
- (QUASI-PROTECTED) The options passed into this form
- $_params : array<string|int, mixed>
- The params submitted by the form and computed by the app
- $_paymentProcessor : array<string|int, mixed>
- The paymentProcessor attributes for this page
- $_paymentProcessorIDs : array<string|int, mixed>
- Available payment processors (IDS).
- $_pcpBlock : array<string|int, mixed>
- Pcp block
- $_pcpInfo : array<string|int, mixed>
- Pcp info
- $_priceSet : array<string|int, mixed>
- Array of fields for the price set
- $_priceSetId : int
- Price Set ID, if the new price set method is used
- $_useForMember : bool
- Contribution page supports memberships
- $_values : array<string|int, mixed>
- The values for the contribution db object
- $ajaxResponse : array<string|int, mixed>
- What to return to the client if in ajax mode (snippet=json)
- $controller : CRM_Core_Controller
- $expectedSmartyVariables : array<string|int, string>
- Variables smarty expects to have set.
- $html5Types : array<string|int, mixed>
- Extra input types we support via the "add" method
- $isBackOffice : bool
- Is this a backoffice form.
- $paymentInstrumentID : int
- Payment instrument if for the transaction.
- $submitOnce : mixed
- $urlPath : array<string|int, mixed>
- Url path used to reach this page
- $_actionButtonName : string
- Name of action button
- $_name : string
- The name of this form
- $_paymentProcessorID : int
- Default or selected processor id.
- $_paymentProcessors : array<string|int, mixed>
- Available payment processors.
- $_renderer : object
- The renderer used for this form
- $_separateMembershipPayment : bool
- Does this form support a separate membership payment
- $_state : object
- The state object that this form belongs to
- $_template : CRM_Core_Smarty
- Cache the smarty template for efficiency reasons
- $_title : string
- The title of this form
- $context : string
- Context of the form being loaded.
- $exportedValues : array<string|int, mixed>
- Values submitted by the user.
- $isPayLater : bool
- Is pay later enabled on this form?
- $optionalQuickFormElements : array<string|int, mixed>
- Quick form elements which are conditionally added to the form.
- $order : CRM_Financial_BAO_Order
- Order object, used to calculate amounts, line items etc.
- $payLaterLabel : string
- The label for the pay later pseudoprocessor option.
- $renewalMembershipID : int
- ID of a membership to be renewed (pass in by url)
- $submittableMoneyFields : array<string|int, mixed>
- Monetary fields that may be submitted.
- $unsavedChangesWarn : bool
- Indicate if this form should warn users of unsaved changes
- $authenticatedContactID : int
- The contact ID that has been authenticated and can be used for checking permissions.
- $isValidated : true
Methods
- __construct() : CRM_Core_Form
- Constructor for the basic form page.
- __get() : mixed
- Provide support for extensions that are used to being able to retrieve _lineItem
- __set() : mixed
- Provide support for extensions that are used to being able to retrieve _lineItem
- add() : HTML_QuickForm_Element
- Simple easy to use wrapper around addElement.
- addAutocomplete() : HTML_QuickForm_Element
- addAutoSelector() : mixed
- Add autoselector field -if user has permission to view contacts If adding this to a form you also need to add to the tpl e.g
- addButtons() : mixed
- Add default Next / Back buttons.
- addChainSelect() : HTML_QuickForm_Element
- Create a chain-select target field. All settings are optional; the defaults usually work.
- addCheckBox() : mixed
- addCIDZeroOptions() : mixed
- Add the options appropriate to cid = zero - ie. autocomplete
- addClass() : mixed
- Add one or more css classes to the form.
- addCurrency() : mixed
- Add currency element to the form.
- addDate() : mixed
- Add date.
- addDatePickerRange() : mixed
- Add a search for a range using date picker fields.
- addDateRange() : mixed
- addDateTime() : mixed
- Function that will add date and time.
- addDefaultButtons() : mixed
- Simple shell that derived classes can call to add buttons to the form with a customized title for the main Submit
- addEntityRef() : HTML_QuickForm_Element
- Create a single or multiple entity ref field.
- addExpectedSmartyVariable() : void
- Add an expected smarty variable to the array.
- addExpectedSmartyVariables() : void
- Add an expected smarty variable to the array.
- addField() : mixed
- Adds a field based on metadata.
- addMoney() : HTML_QuickForm_Element
- Add a currency and money element to the form.
- addOptionalQuickFormElement() : void
- Add an optional element to the optional elements array.
- addProfileSelector() : mixed
- Add a widget for selecting/editing/creating/copying a profile form
- addRadio() : HTML_QuickForm_group
- addRules() : mixed
- This is a virtual function that adds group and global rules to the form.
- addSelect() : HTML_QuickForm_Element
- Adds a select based on field metadata.
- addTaskMenu() : mixed
- Add actions menu to results form.
- addUploadElement() : mixed
- addYesNo() : mixed
- allowAjaxSubmit() : mixed
- Sets form attribute.
- append() : mixed
- Appends values to template variables.
- assign() : mixed
- Assign value to name in template.
- assign_by_ref() : mixed
- Assign value to name in template by reference.
- assignBillingName() : string
- Assign billing name to the template.
- assignBillingType() : mixed
- Assign billing type id to bltID.
- assignEmailField() : mixed
- Assign email variable in the template.
- assignPaymentFields() : mixed
- Assign payment field information to the template.
- assignToTemplate() : mixed
- Assign the minimal set of variables to the template.
- assignVariables() : mixed
- Assign an array of variables to the form/tpl
- buildCustom() : mixed
- Add the custom fields.
- buildForm() : mixed
- Core function that builds the form.
- buildQuickForm() : mixed
- Build the form object.
- cancelAction() : mixed
- Function that can be defined in Form to override or.
- canUseAjaxContactLookups() : bool
- checkTemplateFileExists() : string|null
- Check template file exists.
- error() : mixed
- Error reporting mechanism.
- get() : mixed
- Get the variable from the form scope.
- get_template_vars() : array<string|int, mixed>
- Returns an array containing template variables.
- getAction() : int|null
- Getter for action.
- getAuthenticatedContactID() : int
- Get the authenticated contact ID.
- getCompleteTitle() : string
- getContactID() : int|null
- Get the contact id that the form is being submitted for.
- getContext() : string
- getContributionID() : int|null
- Get the contribution ID.
- getContributionPageID() : int
- Get id of contribution page being acted on.
- getContributionPageValue() : mixed
- Get a value from the contribution being acted on.
- getContributionRecurID() : int|null
- Get the selected Contribution Recur ID.
- getContributionRecurValue() : mixed
- Get the value for a field relating to the contribution recur record.
- getContributionValue() : mixed
- Get the value for a field relating to the contribution.
- getCurrency() : string
- Get the currency for the form.
- getDefaultContext() : mixed
- Classes extending CRM_Core_Form should implement this method.
- getDefaultEntity() : mixed
- Classes extending CRM_Core_Form should implement this method.
- getFormContext() : string
- Get the form context.
- getFormParams() : array<string|int, mixed>
- Helper function for static submit function.
- getHookedTemplateFileName() : mixed
- A wrapper for getTemplateFileName.
- getIsBackOffice() : bool
- getLineItems() : array<string|int, mixed>
- Set the selected line items.
- getLoggedInUserContactID() : int|false
- Get the contact id of the logged in user.
- getName() : string
- Getter function for Name.
- getOptionalQuickFormElements() : array<string|int, mixed>
- Get any quick-form elements that may not be present in the form.
- getPayLaterLabel() : string
- getPaymentMode() : string
- Get the payment mode ('live' or 'test')
- getPaymentProcessorID() : int|null
- Get the ID for the in-use payment processor.
- getPaymentProcessorMode() : string|null
- Get the mode (test or live) of the payment processor.
- getPaymentProcessorValue() : mixed
- Get the value for a field relating to the in-use payment processor.
- getPriceFieldMetaData() : array<string|int, mixed>
- Get price field metadata.
- getPriceSetID() : int|null
- Get the price set for the contribution page.
- getProfileDefaults() : array<string|int, mixed>
- Set default values on form for given contact (or no contact defaults)
- getRenderer() : CRM_Core_Form_Renderer
- Getter function for renderer.
- getRequestedContactID() : int|null
- Get the contact ID that has been requested (via url or form value).
- getRootTitle() : null
- getState() : object
- Getter function for State.
- getStateType() : int
- Getter function for StateType.
- getSubmittedValue() : mixed|null
- Get the submitted value, accessing it from whatever form in the flow it is submitted on.
- getSubmittedValues() : array<string|int, mixed>
- Get values submitted by the user.
- getTemplate() : CRM_Core_Smarty
- getTemplateFileName() : string
- Use the form name to create the tpl file name.
- getTemplateVars() : mixed
- Get the value/s assigned to the Template Engine (Smarty).
- getTitle() : string
- Getter function for title.
- getUFGroupIDs() : array<string|int, mixed>
- Get the active UFGroups (profiles) on this form Many forms load one or more UFGroups (profiles).
- getVar() : mixed
- isFormInEditMode() : bool
- Is the form in edit mode.
- isFormInViewMode() : bool
- Is the form in view mode.
- isPayLater() : bool
- isQuickConfig() : bool
- Is the price set quick config.
- isTest() : bool
- Is the form being submitted in test mode.
- mainProcess() : mixed
- Main process wrapper.
- overrideExtraTemplateFileName() : string
- Add the extra.tpl in.
- postProcess() : mixed
- Process the form.
- postProcessHook() : mixed
- The postProcess hook is typically called by the framework.
- preProcess() : mixed
- Set variables up before form is built.
- preventAjaxSubmit() : mixed
- Sets form attribute.
- processAmountAndGetAutoRenew() : mixed
- Wrapper for processAmount that also sets autorenew.
- processConfirm() : array<string|int, mixed>
- Process payment after confirmation.
- processOnBehalfOrganization() : mixed
- Add on behalf of organization and it's location.
- processPcp() : array<string|int, mixed>
- Function used to se pcp related defaults / params.
- registerFileField() : void
- Register a field with quick form as supporting a file upload.
- registerRules() : mixed
- Register all the standard rules that most forms potentially use.
- removeFileRequiredRules() : mixed
- resetValues() : mixed
- set() : mixed
- Store the variable with the value in the form scope.
- setAction() : mixed
- Setter for action.
- setContext() : mixed
- Set context variable.
- setDefaultValues() : array<string|int, mixed>
- Set default values for the form.
- setFormAmountFields() : mixed
- This function sets the fields.
- setIsPayLater() : mixed
- setLineItems() : void
- Set the selected line items.
- setOptions() : mixed
- Setter function for options.
- setPageTitle() : void
- Sets page title based on entity and action.
- setPayLaterLabel() : mixed
- setPaymentMode() : mixed
- Set the payment mode ('live' or 'test')
- setPriceFieldMetaData() : void
- Set price field metadata.
- setPurifiedDefaults() : mixed
- setSelectedChild() : mixed
- Set the active tab
- setTitle() : mixed
- Setter function for title.
- setVar() : mixed
- submit() : mixed
- Submit function.
- toSmarty() : string
- Render form and return contents.
- unitTestAccessTolegacyProcessMembership() : array<string|int, mixed>
- Temporary function to allow unit tests to access function being refactored away.
- validate() : bool
- Performs the server side validation.
- validateMandatoryFields() : mixed
- Helper function to verify that required fields have been filled.
- wrangleFinancialTypeID() : null|string
- Wrangle financial type ID.
- addPaymentProcessorFieldsToForm() : mixed
- Adds in either a set of radio buttons or hidden fields to contain the payment processors on a front end form
- alterLineItemsForTemplate() : mixed
- Alter line items for template.
- assignLineItemsToTemplate() : mixed
- Assign line items to the template.
- assignPaymentProcessor() : mixed
- This if a front end form function for setting the payment processor.
- assignTotalAmounts() : void
- Assign the total amounts for display on Confirm and ThankYou pages.
- bounceOnError() : void
- Bounce the user back to retry when an error occurs.
- buildPremiumsBlock() : void
- Build Premium Block im Contribution Pages.
- compileErrorMessage() : string
- Turn array of errors into message string.
- defineRenewalMembership() : void
- doMembershipProcessing() : mixed
- Membership processing section.
- formatParamsForPaymentProcessor() : array<string|int, mixed>
- Format the fields in $this->_params for the payment processor.
- getApiAction() : mixed
- Based on form action, return a string representing the api action.
- getAuthenticatedCheckSumContactID() : int
- Get the contact ID authenticated as a valid by checksum.
- getAvailablePaymentProcessorIDS() : false|array<string|int, mixed>
- Get the payment processor IDs available on the form.
- getAvailablePaymentProcessors() : array<string|int, mixed>
- Get the payment processors that are available on the form.
- getContactIDIfAccessingOwnRecord() : int|false
- Get the contact if from the url, using the checksum or the cid if it is the logged in user.
- getExistingContributionID() : int|null
- Get the id of an existing contribution the submitter is attempting to pay.
- getExistingContributionLineItems() : array<string|int, mixed>
- getFieldsToExcludeFromPurification() : array<string|int, mixed>
- Override this in a subclass to prevent fields intended to contain "raw html" from getting broken. E.g. system message templates
- getLineItemsForMembershipCreate() : array<string|int, mixed>
- Get the line items for the membership create call.
- getMainContributionAmount() : float
- Get the amount for the main contribution.
- getMainContributionAmountLevel() : string
- Get the amount level description for the main contribution.
- getMembershipBlock() : array<string|int, mixed>|false
- Get the membership block configured for the page, fetching if needed.
- getOrder() : CRM_Financial_BAO_Order
- getPaymentProcessorObject() : CRM_Core_Payment
- Get the payment processor object for the submission, returning the manual one for offline payments.
- getPaymentProcessorTitle() : string
- Get the title of the payment processor to display to the user Note: There is an identical function in CRM_Core_Payment
- getPcpID() : int|null
- Get the PCP ID being contributed to.
- getProcessors() : array<string|int, mixed>
- Get the configured processors, including the pay later processor.
- getProductID() : int|bool
- getRenewalMembershipID() : bool|int
- Get the id of the membership the contact is trying to renew.
- getSubmittableFields() : array<string|int, string>
- Get the fields that can be submitted in this form flow.
- handlePreApproval() : mixed
- Handle pre approval for processors.
- initializeOrder() : void
- isFormInViewOrEditMode() : bool
- Is the form in view or edit mode.
- isMembershipPriceSet() : bool
- Is a (non-quick-config) membership price set in use.
- isPaymentTransaction() : bool
- Is a payment being made.
- isSeparateMembershipPayment() : bool
- Is the contribution page configured for 2 payments, one being membership & one not.
- isSeparateMembershipTransaction() : bool
- Are we going to do 2 financial transactions.
- isSeparatePaymentSelected() : bool
- Is the form separate payment AND has the user selected 2 options, resulting in 2 payments.
- isShowMembershipBlock() : bool
- Should the membership block be displayed.
- legacyProcessMembership() : array<string|int, mixed>
- Interim function for processing memberships - this is being refactored out of existence.
- postProcessMembership() : mixed
- Process the Memberships.
- postProcessPremium() : mixed
- Process the form.
- prepareParamsForPaymentProcessor() : array<string|int, mixed>
- Format the fields in $params for the payment processor.
- preProcessPaymentOptions() : mixed
- Handle Payment Processor switching for contribution and event registration forms.
- processFormContribution() : CRM_Contribute_DAO_Contribution
- Process the contribution.
- processFormSubmission() : array<string|int, mixed>
- Post form submission handling.
- processMembership() : void
- Process membership.
- pushUrlToUserContext() : void
- Push path to the userContext (defaults to current url path).
- setContactID() : null|int
- Get contact iD for a form object.
- setRecurringMembershipParams() : mixed
- Determine if recurring parameters need to be added to the form parameters.
- setTranslatedFields() : mixed
- Set translated fields.
- validateAuthenticatedCheckSumContactID() : int
- Verify that a contact ID is authenticated as a valid contact by checksum
- authenticatePledgeUser() : void
- Authenticate pledge user during online payment.
- buildMembershipBlock() : bool
- Build Membership Block in Contribution Pages.
- formatReferenceFieldAttributes() : mixed
- getContributionParams() : array<string|int, mixed>
- Set the parameters to be passed to contribution create function.
- getMembershipParamsFromPriceSet() : array<string|int, mixed>
- Extract the selected memberships from a priceSet
- getNonDeductibleAmount() : array<string|int, mixed>
- Get non-deductible amount.
- handlePledge() : mixed
- Previously shared code.
- initSet() : mixed
- Initiate price set such that various non-BAO things are set on the form.
- isMembershipSelected() : bool
- Return True/False if we have a membership selected on the contribution page
- preProcessChainSelectFields() : mixed
- Set options and attributes for chain select fields based on the controlling field's value
- processRecurringContribution() : int|null
- Create the recurring contribution record.
- processSecondaryFinancialTransaction() : array<string|int, array<string|int, mixed>>
- Where a second separate financial transaction is supported we will process it here.
- selectOrAnyPlaceholder() : string
- Handles a repeated bit supplying a placeholder for entity selection
- validateChainSelectFields() : mixed
- Validate country / state / county match and suppress unwanted "required" errors
Constants
ATTR_SPACING
Constants for attributes for various form elements attempt to standardize on the number of variations that we use of the below form elements
public
string
ATTR_SPACING
= ' '
CB_PREFIX
All checkboxes are defined with a common prefix. This allows us to have the same javascript to check / clear all the checkboxes etc If u have multiple groups of checkboxes, you will need to give them different ids to avoid potential name collision
public
string|int
CB_PREFIX
= 'mark_x_'
CB_PREFIX_LEN
All checkboxes are defined with a common prefix. This allows us to have the same javascript to check / clear all the checkboxes etc If u have multiple groups of checkboxes, you will need to give them different ids to avoid potential name collision
public
string|int
CB_PREFIX_LEN
= 7
CB_PREFIY
All checkboxes are defined with a common prefix. This allows us to have the same javascript to check / clear all the checkboxes etc If u have multiple groups of checkboxes, you will need to give them different ids to avoid potential name collision
public
string|int
CB_PREFIY
= 'mark_y_'
CB_PREFIZ
All checkboxes are defined with a common prefix. This allows us to have the same javascript to check / clear all the checkboxes etc If u have multiple groups of checkboxes, you will need to give them different ids to avoid potential name collision
public
string|int
CB_PREFIZ
= 'mark_z_'
Properties
$_action
(QUASI-PROTECTED) The mode of operation for this form
public
int
$_action
This field should marked protected
and is not generally
intended for external callers, but some edge-cases do use it.
$_amount
Cache the amount to make things easier
public
float
$_amount
$_bltID
The billing location id for this contribution page.
public
int
$_bltID
$_ccid
The contribution ID - is an option in the URL if you are making a payment against an existing contribution (an "invoice payment").
public
int
$_ccid
$_contactID
The id of the contact associated with this contribution.
public
int
$_contactID
$_contributionID
The id of the contribution object that is created when the form is submitted, or passed in.
use getContributionID()
public
int
$_contributionID
$_defaults
The default values for the form.
public
array<string|int, mixed>
$_defaults
= []
$_emailExists
Flag if email field exists in embedded profile
public
bool
$_emailExists
= \FALSE
$_fields
The fields involved in this contribution page
public
array<string|int, mixed>
$_fields
= []
$_id
The id of the contribution page that we are processing.
public
int
$_id
$_isBillingAddressRequiredForPayLater
public
bool
$_isBillingAddressRequiredForPayLater
$_membershipBlock
The membership block for this page
public
array<string|int, mixed>
$_membershipBlock
= \NULL
$_membershipContactID
The contact id related to a membership
public
int
$_membershipContactID
$_membershipId
The Membership ID for membership renewal
public
int
$_membershipId
$_mode
The mode that we are in
public
string
$_mode
Tags
$_options
(QUASI-PROTECTED) The options passed into this form
public
mixed
$_options
= \NULL
This field should marked protected
and is not generally
intended for external callers, but some edge-cases do use it.
$_params
The params submitted by the form and computed by the app
public
array<string|int, mixed>
$_params
= []
$_paymentProcessor
The paymentProcessor attributes for this page
public
array<string|int, mixed>
$_paymentProcessor
$_paymentProcessorIDs
Available payment processors (IDS).
public
array<string|int, mixed>
$_paymentProcessorIDs
As part of trying to consolidate various payment pages we store processors here & have functions at this level to manage them. An alternative would be to have a separate Form that is inherited by all forms that allow payment processing.
An array of the IDS available on this form.
$_pcpBlock
Pcp block
public
array<string|int, mixed>
$_pcpBlock
$_pcpInfo
Pcp info
public
array<string|int, mixed>
$_pcpInfo
$_priceSet
Array of fields for the price set
public
array<string|int, mixed>
$_priceSet
$_priceSetId
Price Set ID, if the new price set method is used
public
int
$_priceSetId
$_useForMember
Contribution page supports memberships
public
bool
$_useForMember
$_values
The values for the contribution db object
public
array<string|int, mixed>
$_values
$ajaxResponse
What to return to the client if in ajax mode (snippet=json)
public
array<string|int, mixed>
$ajaxResponse
= []
$controller
public
CRM_Core_Controller
$controller
$expectedSmartyVariables
Variables smarty expects to have set.
public
array<string|int, string>
$expectedSmartyVariables
= [
// in CMSPrint.tpl
'breadcrumb',
'pageTitle',
'urlIsPublic',
'isDeleted',
// in 'body.tpl
'suppressForm',
'beginHookFormElements',
// required for footer.tpl
'contactId',
// required for info.tpl
'infoMessage',
'infoTitle',
'infoType',
'infoOptions',
// required for attachmentjs.tpl
'context',
// FormButtons.tpl (adds buttons to forms).
'linkButtons',
// Required for contactFooter.tpl.
// See CRM_Activity_Form_ActivityTest:testInboundEmailDisplaysWithLineBreaks.
'external_identifier',
'lastModified',
'created_date',
'changeLog',
// Required for footer.tpl,
// See CRM_Activity_Form_ActivityTest:testInboundEmailDisplaysWithLineBreaks.
'footer_status_severity',
// Required for some profiles (e.g on the Main page of the contribution form flow).
// A bit tricky to add closer to the usage due to conditionality of inclusion
'showCMS',
]
We ensure these are assigned (value = NULL) when Smarty is instantiated in order to avoid e-notices / having to use empty or isset in the template layer.
$html5Types
Extra input types we support via the "add" method
public
static array<string|int, mixed>
$html5Types
= ['number', 'url', 'email', 'color']
$isBackOffice
Is this a backoffice form.
public
bool
$isBackOffice
= \FALSE
Processors may display different options to backoffice users.
$paymentInstrumentID
Payment instrument if for the transaction.
public
int
$paymentInstrumentID
This will generally be drawn from the payment processor and is ignored for front end forms.
$submitOnce
public
mixed
$submitOnce
= \TRUE
$urlPath
Url path used to reach this page
public
array<string|int, mixed>
$urlPath
= []
$_actionButtonName
Name of action button
protected
string
$_actionButtonName
$_name
The name of this form
protected
string
$_name
$_paymentProcessorID
Default or selected processor id.
protected
int
$_paymentProcessorID
As part of trying to consolidate various payment pages we store processors here & have functions at this level to manage them. An alternative would be to have a separate Form that is inherited by all forms that allow payment processing.
$_paymentProcessors
Available payment processors.
protected
array<string|int, mixed>
$_paymentProcessors
As part of trying to consolidate various payment pages we store processors here & have functions at this level to manage them.
An array of payment processor details with objects loaded in the 'object' field.
$_renderer
The renderer used for this form
protected
object
$_renderer
$_separateMembershipPayment
Does this form support a separate membership payment
use $this->isSeparateMembershipPayment() function.
protected
bool
$_separateMembershipPayment
$_state
The state object that this form belongs to
protected
object
$_state
$_template
Cache the smarty template for efficiency reasons
protected
static CRM_Core_Smarty
$_template
$_title
The title of this form
protected
string
$_title
= \NULL
$context
Context of the form being loaded.
protected
string
$context
'event' or null
$exportedValues
Values submitted by the user.
protected
array<string|int, mixed>
$exportedValues
= []
These values have been checked for injection per https://pear.php.net/manual/en/package.html.html-quickform.html-quickform.exportvalues.php and are as submitted.
Once set this array should be treated as read only.
$isPayLater
Is pay later enabled on this form?
protected
bool
$isPayLater
= \FALSE
$optionalQuickFormElements
Quick form elements which are conditionally added to the form.
protected
array<string|int, mixed>
$optionalQuickFormElements
= []
Elements in this array will be added to the form at the end if not present so that smarty does not e-notice on things like '{if $form.group}' when 'group' is not added to the form (e.g when no groups exist).
$order
Order object, used to calculate amounts, line items etc.
protected
CRM_Financial_BAO_Order
$order
$payLaterLabel
The label for the pay later pseudoprocessor option.
protected
string
$payLaterLabel
$renewalMembershipID
ID of a membership to be renewed (pass in by url)
protected
int
$renewalMembershipID
$submittableMoneyFields
Monetary fields that may be submitted.
protected
array<string|int, mixed>
$submittableMoneyFields
= []
Any fields in this list will be converted to non-localised format
if retrieved by getSubmittedValue
$unsavedChangesWarn
Indicate if this form should warn users of unsaved changes
protected
bool
$unsavedChangesWarn
$authenticatedContactID
The contact ID that has been authenticated and can be used for checking permissions.
private
int
$authenticatedContactID
It could be a combination of cid in the url plus a checksum or the logged in user. Importantly it can be used to run permission checks on.
$isValidated
private
true
$isValidated
= \FALSE
Methods
__construct()
Constructor for the basic form page.
public
__construct([object $state = NULL ][, int $action = CRM_Core_Action::NONE ][, string $method = 'post' ][, string $name = NULL ]) : CRM_Core_Form
We should not use QuickForm directly. This class provides a lot of default convenient functions, rules and buttons
Parameters
- $state : object = NULL
-
State associated with this form.
- $action : int = CRM_Core_Action::NONE
-
The mode the form is operating in (None/Create/View/Update/Delete)
- $method : string = 'post'
-
The type of http method used (GET/POST).
- $name : string = NULL
-
The name of the form if different from class name.
Return values
CRM_Core_Form__get()
Provide support for extensions that are used to being able to retrieve _lineItem
public
__get(string $name) : mixed
Note extension should call getPriceSetID() and getLineItems() directly. They are supported for external use per the api annotation.
Parameters
- $name : string
Tags
__set()
Provide support for extensions that are used to being able to retrieve _lineItem
public
__set(string $name, mixed $value) : mixed
Note extension should call getPriceSetID() and getLineItems() directly. They are supported for external use per the api annotation.
Parameters
- $name : string
- $value : mixed
add()
Simple easy to use wrapper around addElement.
public
& add(string $type, string $name[, string $label = '' ][, array<string|int, mixed> $attributes = NULL ][, bool $required = FALSE ][, array<string|int, mixed> $extra = NULL ]) : HTML_QuickForm_Element
Deal with simple validation rules.
Parameters
- $type : string
- $name : string
- $label : string = ''
- $attributes : array<string|int, mixed> = NULL
-
(options for select elements)
- $required : bool = FALSE
- $extra : array<string|int, mixed> = NULL
-
(attributes for select elements). For datepicker elements this is consistent with the data from CRM_Utils_Date::getDatePickerExtra
Tags
Return values
HTML_QuickForm_Element —Could be an error object
addAutocomplete()
public
addAutocomplete(string $name[, string $label = '' ][, array<string|int, mixed> $props = [] ][, bool $required = FALSE ]) : HTML_QuickForm_Element
Parameters
- $name : string
- $label : string = ''
- $props : array<string|int, mixed> = []
- $required : bool = FALSE
Return values
HTML_QuickForm_ElementaddAutoSelector()
Add autoselector field -if user has permission to view contacts If adding this to a form you also need to add to the tpl e.g
public
addAutoSelector([array<string|int, mixed> $profiles = [] ][, array<string|int, mixed> $autoCompleteField = [] ]) : mixed
{if !empty($selectable)}
Parameters
- $profiles : array<string|int, mixed> = []
-
Ids of profiles that are on the form (to be autofilled).
- $autoCompleteField : array<string|int, mixed> = []
-
- name_field
- id_field
- url (for ajax lookup)
Tags
addButtons()
Add default Next / Back buttons.
public
addButtons(array<string|int, mixed> $params) : mixed
Parameters
- $params : array<string|int, mixed>
-
Array of associative arrays in the order in which the buttons should be displayed. The associate array has 3 fields: 'type', 'name' and 'isDefault' The base form class will define a bunch of static arrays for commonly used formats.
addChainSelect()
Create a chain-select target field. All settings are optional; the defaults usually work.
public
addChainSelect(string $elementName[, array<string|int, mixed> $settings = [] ]) : HTML_QuickForm_Element
Parameters
- $elementName : string
- $settings : array<string|int, mixed> = []
Return values
HTML_QuickForm_ElementaddCheckBox()
public
addCheckBox(int $id, string $title, array<string|int, mixed> $values[, null $other = NULL ][, null $attributes = NULL ][, null $required = NULL ][, null $javascriptMethod = NULL ][, string $separator = '<br />' ][, bool $flipValues = FALSE ]) : mixed
Parameters
- $id : int
- $title : string
- $values : array<string|int, mixed>
- $other : null = NULL
- $attributes : null = NULL
- $required : null = NULL
- $javascriptMethod : null = NULL
- $separator : string = '<br />'
- $flipValues : bool = FALSE
addCIDZeroOptions()
Add the options appropriate to cid = zero - ie. autocomplete
public
addCIDZeroOptions() : mixed
Tags
addClass()
Add one or more css classes to the form.
public
addClass(string $className) : mixed
Parameters
- $className : string
addCurrency()
Add currency element to the form.
public
addCurrency([string $name = 'currency' ][, string $label = NULL ][, bool $required = TRUE ][, string $defaultCurrency = NULL ][, bool $freezeCurrency = FALSE ][, bool $setDefaultCurrency = TRUE ]) : mixed
Parameters
- $name : string = 'currency'
- $label : string = NULL
- $required : bool = TRUE
- $defaultCurrency : string = NULL
- $freezeCurrency : bool = FALSE
- $setDefaultCurrency : bool = TRUE
addDate()
Add date.
public
addDate(string $name, string $label[, bool $required = FALSE ][, array<string|int, mixed> $attributes = NULL ]) : mixed
Use $this->add('datepicker', ...) instead.
Parameters
- $name : string
-
Name of the element.
- $label : string
-
Label of the element.
- $required : bool = FALSE
-
True if required.
- $attributes : array<string|int, mixed> = NULL
-
Key / value pair.
addDatePickerRange()
Add a search for a range using date picker fields.
public
addDatePickerRange(string $fieldName, string $label[, bool $isDateTime = FALSE ][, bool $required = FALSE ][, string $fromLabel = 'From' ][, string $toLabel = 'To' ][, array<string|int, mixed> $additionalOptions = [] ][, string $to = '_high' ][, string $from = '_low' ]) : mixed
Parameters
- $fieldName : string
- $label : string
- $isDateTime : bool = FALSE
-
Is this a date-time field (not just date).
- $required : bool = FALSE
- $fromLabel : string = 'From'
- $toLabel : string = 'To'
- $additionalOptions : array<string|int, mixed> = []
- $to : string = '_high'
-
string to append to the to field.
- $from : string = '_low'
-
string to append to the from field.
addDateRange()
public
addDateRange(string $name[, string $from = '_from' ][, string $to = '_to' ][, string $label = 'From:' ][, string $dateFormat = 'searchDate' ][, bool $required = FALSE ][, bool $displayTime = FALSE ]) : mixed
Use $this->addDatePickerRange() instead.
Parameters
- $name : string
- $from : string = '_from'
- $to : string = '_to'
- $label : string = 'From:'
- $dateFormat : string = 'searchDate'
- $required : bool = FALSE
- $displayTime : bool = FALSE
addDateTime()
Function that will add date and time.
public
addDateTime(string $name, string $label[, bool $required = FALSE ][, array<string|int, mixed> $attributes = NULL ]) : mixed
Use $this->add('datepicker', ...) instead.
Parameters
- $name : string
- $label : string
- $required : bool = FALSE
- $attributes : array<string|int, mixed> = NULL
addDefaultButtons()
Simple shell that derived classes can call to add buttons to the form with a customized title for the main Submit
public
addDefaultButtons(string $title[, string $nextType = 'next' ][, string $backType = 'back' ][, bool|string $submitOnce = FALSE ]) : mixed
Parameters
- $title : string
-
Title of the main button.
- $nextType : string = 'next'
-
Button type for the form after processing.
- $backType : string = 'back'
- $submitOnce : bool|string = FALSE
addEntityRef()
Create a single or multiple entity ref field.
public
addEntityRef(string $name[, string $label = '' ][, array<string|int, mixed> $props = [] ][, bool $required = FALSE ]) : HTML_QuickForm_Element
Parameters
- $name : string
- $label : string = ''
- $props : array<string|int, mixed> = []
-
Mix of html and widget properties, including:.
- select - params to give to select2 widget
- entity - defaults to Contact
- create - can the user create a new entity on-the-fly? Set to TRUE if entity is contact and you want the default profiles, or pass in your own set of links. @see CRM_Campaign_BAO_Campaign::getEntityRefCreateLinks for format note that permissions are checked automatically
- api - array of settings for the getlist api wrapper note that it accepts a 'params' setting which will be passed to the underlying api
- placeholder - string
- multiple - bool
- class, etc. - other html properties
- $required : bool = FALSE
Return values
HTML_QuickForm_ElementaddExpectedSmartyVariable()
Add an expected smarty variable to the array.
public
addExpectedSmartyVariable(string $elementName) : void
Parameters
- $elementName : string
addExpectedSmartyVariables()
Add an expected smarty variable to the array.
public
addExpectedSmartyVariables(array<string|int, mixed> $elementNames) : void
Parameters
- $elementNames : array<string|int, mixed>
addField()
Adds a field based on metadata.
public
addField(mixed $name[, array<string|int, mixed> $props = [] ][, bool $required = FALSE ][, bool $legacyDate = TRUE ]) : mixed
Parameters
- $name : mixed
-
Field name to go on the form.
- $props : array<string|int, mixed> = []
-
Mix of html attributes and special properties, namely.
- entity (api entity name, can usually be inferred automatically from the form class)
- name (field name - only needed if different from name used on the form)
- option_url - path to edit this option list - usually retrieved automatically - set to NULL to disable link
- placeholder - set to NULL to disable
- multiple - bool
- context - @see CRM_Core_DAO::buildOptionsContext
- $required : bool = FALSE
- $legacyDate : bool = TRUE
-
Temporary param to facilitate the conversion of fields to use the datepicker in a controlled way. To convert the field the jcalendar code needs to be removed from the tpl as well. That file is intended to be EOL.
Tags
Return values
mixed —HTML_QuickForm_element void
addMoney()
Add a currency and money element to the form.
public
addMoney(string $name, string $label[, bool $required = FALSE ][, array<string|int, mixed> $attributes = NULL ][, bool $addCurrency = TRUE ][, string $currencyName = 'currency' ][, string $defaultCurrency = NULL ][, bool $freezeCurrency = FALSE ]) : HTML_QuickForm_Element
Parameters
- $name : string
- $label : string
- $required : bool = FALSE
- $attributes : array<string|int, mixed> = NULL
- $addCurrency : bool = TRUE
- $currencyName : string = 'currency'
- $defaultCurrency : string = NULL
- $freezeCurrency : bool = FALSE
Return values
HTML_QuickForm_ElementaddOptionalQuickFormElement()
Add an optional element to the optional elements array.
public
addOptionalQuickFormElement(string $elementName) : void
These elements are assigned as empty (null) variables if there is no real field - allowing smarty to use them without notices.
Parameters
- $elementName : string
addProfileSelector()
Add a widget for selecting/editing/creating/copying a profile form
public
addProfileSelector(string $name, string $label, string $allowCoreTypes, string $allowSubTypes, array<string|int, mixed> $entities[, bool $default = FALSE ][, string $usedFor = NULL ]) : mixed
Parameters
- $name : string
-
HTML form-element name.
- $label : string
-
Printable label.
- $allowCoreTypes : string
-
Only present a UFGroup if its group_type includes a subset of $allowCoreTypes; e.g. 'Individual', 'Activity'.
- $allowSubTypes : string
-
Only present a UFGroup if its group_type is compatible with $allowSubypes.
- $entities : array<string|int, mixed>
- $default : bool = FALSE
-
//CRM-15427.
- $usedFor : string = NULL
addRadio()
public
& addRadio(string $name, string $title, array<string|int, mixed> $values[, array<string|int, mixed> $attributes = [] ][, string $separator = NULL ][, bool $required = FALSE ][, array<string|int, mixed> $optionAttributes = [] ]) : HTML_QuickForm_group
Parameters
- $name : string
- $title : string
- $values : array<string|int, mixed>
- $attributes : array<string|int, mixed> = []
- $separator : string = NULL
- $required : bool = FALSE
- $optionAttributes : array<string|int, mixed> = []
-
- Option specific attributes
Return values
HTML_QuickForm_groupaddRules()
This is a virtual function that adds group and global rules to the form.
public
addRules() : mixed
Keeping it distinct from the form to keep code small and localized in the form building code
addSelect()
Adds a select based on field metadata.
public
addSelect(string $name[, array<string|int, mixed> $props = [] ][, bool $required = FALSE ]) : HTML_QuickForm_Element
TODO: This could be even more generic and widget type (select in this case) could also be read from metadata Perhaps a method like $form->bind($name) which would look up all metadata for named field
Parameters
- $name : string
-
Field name to go on the form.
- $props : array<string|int, mixed> = []
-
Mix of html attributes and special properties, namely.
- entity (api entity name, can usually be inferred automatically from the form class)
- field (field name - only needed if different from name used on the form)
- option_url - path to edit this option list - usually retrieved automatically - set to NULL to disable link
- placeholder - set to NULL to disable
- multiple - bool
- context - @see CRM_Core_DAO::buildOptionsContext
- $required : bool = FALSE
Tags
Return values
HTML_QuickForm_ElementaddTaskMenu()
Add actions menu to results form.
public
addTaskMenu(array<string|int, mixed> $tasks) : mixed
Parameters
- $tasks : array<string|int, mixed>
addUploadElement()
public
addUploadElement(array<string|int, string>|string $elementName) : mixed
Parameters
- $elementName : array<string|int, string>|string
addYesNo()
public
addYesNo(string $id, string $title[, bool $allowClear = FALSE ][, bool $required = NULL ][, array<string|int, mixed> $attributes = [] ]) : mixed
Parameters
- $id : string
- $title : string
- $allowClear : bool = FALSE
- $required : bool = NULL
- $attributes : array<string|int, mixed> = []
allowAjaxSubmit()
Sets form attribute.
public
allowAjaxSubmit() : mixed
Tags
append()
Appends values to template variables.
public
append(array<string|int, mixed>|string $tpl_var[, mixed $value = NULL ][, bool $merge = FALSE ]) : mixed
Parameters
- $tpl_var : array<string|int, mixed>|string
-
the template variable name(s)
- $value : mixed = NULL
-
The value to append.
- $merge : bool = FALSE
assign()
Assign value to name in template.
public
assign(string $var[, mixed $value = NULL ]) : mixed
Parameters
- $var : string
-
Name of variable.
- $value : mixed = NULL
-
Value of variable.
assign_by_ref()
Assign value to name in template by reference.
public
assign_by_ref(string $var, mixed &$value) : mixed
since 5.72 will be removed around 5.84
Parameters
- $var : string
-
Name of variable.
- $value : mixed
-
Value of variable.
assignBillingName()
Assign billing name to the template.
public
assignBillingName([array<string|int, mixed> $params = [] ]) : string
Parameters
- $params : array<string|int, mixed> = []
-
Form input params, default to $this->_params.
Return values
stringassignBillingType()
Assign billing type id to bltID.
public
assignBillingType() : mixed
Tags
assignEmailField()
Assign email variable in the template.
public
assignEmailField() : mixed
assignPaymentFields()
Assign payment field information to the template.
public
assignPaymentFields() : mixed
Tags
assignToTemplate()
Assign the minimal set of variables to the template.
public
assignToTemplate() : mixed
assignVariables()
Assign an array of variables to the form/tpl
public
assignVariables(array<string|int, mixed> $values, array<string|int, mixed> $keys) : mixed
Parameters
- $values : array<string|int, mixed>
-
Array of [key => value] to assign to the form
- $keys : array<string|int, mixed>
-
Array of keys to assign from the values array
buildCustom()
Add the custom fields.
public
buildCustom(int $id, string $name[, bool $viewOnly = FALSE ][, null $profileContactType = NULL ][, array<string|int, mixed> $fieldTypes = NULL ]) : mixed
Parameters
- $id : int
- $name : string
- $viewOnly : bool = FALSE
- $profileContactType : null = NULL
- $fieldTypes : array<string|int, mixed> = NULL
buildForm()
Core function that builds the form.
public
buildForm() : mixed
We redefine this function here and expect all CRM forms to build their form in the function buildQuickForm.
buildQuickForm()
Build the form object.
public
buildQuickForm() : mixed
Tags
cancelAction()
Function that can be defined in Form to override or.
public
cancelAction() : mixed
perform specific action on cancel action
canUseAjaxContactLookups()
public
canUseAjaxContactLookups() : bool
Return values
boolcheckTemplateFileExists()
Check template file exists.
public
checkTemplateFileExists([string|null $suffix = NULL ]) : string|null
Parameters
- $suffix : string|null = NULL
Return values
string|null —Template file path, else null
error()
Error reporting mechanism.
public
error(string $message[, int $code = NULL ][, CRM_Core_DAO $dao = NULL ]) : mixed
Parameters
- $message : string
-
Error Message.
- $code : int = NULL
-
Error Code.
- $dao : CRM_Core_DAO = NULL
-
A data access object on which we perform a rollback if non - empty.
get()
Get the variable from the form scope.
public
get(string $name) : mixed
Parameters
- $name : string
-
Name of the variable
get_template_vars()
Returns an array containing template variables.
public
get_template_vars([string $name = NULL ]) : array<string|int, mixed>
since 5.69 will be removed around 5.93. use getTemplateVars.
Parameters
- $name : string = NULL
Return values
array<string|int, mixed>getAction()
Getter for action.
public
getAction() : int|null
Return values
int|nullgetAuthenticatedContactID()
Get the authenticated contact ID.
public
getAuthenticatedContactID() : int
This is either
- a contact ID authenticated by checksum
- the logged in user
- 0 for none.
Tags
Return values
intgetCompleteTitle()
public
getCompleteTitle() : string
Return values
stringgetContactID()
Get the contact id that the form is being submitted for.
public
getContactID() : int|null
Return values
int|nullgetContext()
public
getContext() : string
Return values
stringgetContributionID()
Get the contribution ID.
public
getContributionID() : int|null
Return values
int|nullgetContributionPageID()
Get id of contribution page being acted on.
public
getContributionPageID() : int
Return values
intgetContributionPageValue()
Get a value from the contribution being acted on.
public
getContributionPageValue(string $fieldName) : mixed
All values returned in apiv4 format. Escaping may be required.
Parameters
- $fieldName : string
Tags
getContributionRecurID()
Get the selected Contribution Recur ID.
public
getContributionRecurID() : int|null
Tags
Return values
int|nullgetContributionRecurValue()
Get the value for a field relating to the contribution recur record.
public
getContributionRecurValue(string $fieldName) : mixed
All values returned in apiv4 format. Escaping may be required.
Parameters
- $fieldName : string
Tags
getContributionValue()
Get the value for a field relating to the contribution.
public
getContributionValue(string $fieldName) : mixed
All values returned in apiv4 format. Escaping may be required.
Parameters
- $fieldName : string
Tags
getCurrency()
Get the currency for the form.
public
getCurrency() : string
Rather historic - might have unneeded stuff
Tags
Return values
stringgetDefaultContext()
Classes extending CRM_Core_Form should implement this method.
public
getDefaultContext() : mixed
TODO: Merge with CRM_Core_DAO::buildOptionsContext($context) and add validation.
Tags
getDefaultEntity()
Classes extending CRM_Core_Form should implement this method.
public
getDefaultEntity() : mixed
Tags
getFormContext()
Get the form context.
public
getFormContext() : string
This is important for passing to the buildAmount hook as CiviDiscount checks it.
Return values
stringgetFormParams()
Helper function for static submit function.
public
static getFormParams(int $id, array<string|int, mixed> $params) : array<string|int, mixed>
Set relevant params - help us to build up an array that we can pass in.
Parameters
- $id : int
- $params : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getHookedTemplateFileName()
A wrapper for getTemplateFileName.
public
getHookedTemplateFileName() : mixed
This includes calling the hook to prevent us from having to copy & paste the logic of calling the hook.
getIsBackOffice()
public
getIsBackOffice() : bool
Return values
boolgetLineItems()
Set the selected line items.
public
getLineItems() : array<string|int, mixed>
This returns all selected line items, even if they will be split to a secondary contribution.
Tags
Return values
array<string|int, mixed>getLoggedInUserContactID()
Get the contact id of the logged in user.
public
getLoggedInUserContactID() : int|false
Return values
int|falsegetName()
Getter function for Name.
public
getName() : string
Return values
stringgetOptionalQuickFormElements()
Get any quick-form elements that may not be present in the form.
public
getOptionalQuickFormElements() : array<string|int, mixed>
To make life simpler for smarty we ensure they are set to null rather than unset. This is done at the last minute when $this is converted to an array to be assigned to the form.
Return values
array<string|int, mixed>getPayLaterLabel()
public
getPayLaterLabel() : string
Return values
stringgetPaymentMode()
Get the payment mode ('live' or 'test')
public
getPaymentMode() : string
Return values
stringgetPaymentProcessorID()
Get the ID for the in-use payment processor.
public
getPaymentProcessorID() : int|null
Return values
int|nullgetPaymentProcessorMode()
Get the mode (test or live) of the payment processor.
public
getPaymentProcessorMode() : string|null
Tags
Return values
string|null —test or live
getPaymentProcessorValue()
Get the value for a field relating to the in-use payment processor.
public
getPaymentProcessorValue(string $fieldName) : mixed
All values returned in apiv4 format. Escaping may be required.
Parameters
- $fieldName : string
Tags
getPriceFieldMetaData()
Get price field metadata.
public
getPriceFieldMetaData() : array<string|int, mixed>
The returned value is an array of arrays where each array is an id-keyed price field and an 'options' key has been added to that arry for any options.
Return values
array<string|int, mixed>getPriceSetID()
Get the price set for the contribution page.
public
getPriceSetID() : int|null
Note that we use the get
from the form as a legacy method but
ideally we would just load from the BAO method & not pass using the
form. It does not confer meaningful performance benefits & adds confusion.
Out of caution we still allow get
, set
to take precedence.
Tags
Return values
int|nullgetProfileDefaults()
Set default values on form for given contact (or no contact defaults)
public
getProfileDefaults([mixed $profile_id = 'Billing' ][, int $contactID = NULL ]) : array<string|int, mixed>
Parameters
- $profile_id : mixed = 'Billing'
-
(can be id, or profile name).
- $contactID : int = NULL
Return values
array<string|int, mixed>getRenderer()
Getter function for renderer.
public
& getRenderer() : CRM_Core_Form_Renderer
If renderer is not set create one and initialize it.
Return values
CRM_Core_Form_RenderergetRequestedContactID()
Get the contact ID that has been requested (via url or form value).
public
getRequestedContactID() : int|null
Ideally the forms would override this so only the cid in the url would be checked in the shared form function.
Tags
Return values
int|nullgetRootTitle()
public
getRootTitle() : null
Return values
nullgetState()
Getter function for State.
public
& getState() : object
Return values
objectgetStateType()
Getter function for StateType.
public
getStateType() : int
Return values
intgetSubmittedValue()
Get the submitted value, accessing it from whatever form in the flow it is submitted on.
public
getSubmittedValue(string $fieldName) : mixed|null
Parameters
- $fieldName : string
Return values
mixed|nullgetSubmittedValues()
Get values submitted by the user.
public
getSubmittedValues() : array<string|int, mixed>
Compared with $this->controller->exportValues this has a couple of changes
- any fields declared in $this->submittableMoneyFields will be de-formatted first.
- it is possible to store access fields from related forms if they
are declared in
getSubmittableFields()
. This is notably used in imports to combine fields from the various screens & save the resulting 'submitted_values' to the UserJob.
Return values
array<string|int, mixed>getTemplate()
public
static & getTemplate() : CRM_Core_Smarty
Return values
CRM_Core_SmartygetTemplateFileName()
Use the form name to create the tpl file name.
public
getTemplateFileName() : string
Return values
stringgetTemplateVars()
Get the value/s assigned to the Template Engine (Smarty).
public
getTemplateVars([string|null $name = NULL ]) : mixed
Parameters
- $name : string|null = NULL
getTitle()
Getter function for title.
public
getTitle() : string
Should be over-ridden by derived class.
Return values
stringgetUFGroupIDs()
Get the active UFGroups (profiles) on this form Many forms load one or more UFGroups (profiles).
public
getUFGroupIDs() : array<string|int, mixed>
This provides a standard function to retrieve the IDs of those profiles from the form so that you can implement things such as "is is_captcha field set on any of the active profiles on this form?"
NOT SUPPORTED FOR USE OUTSIDE CORE EXTENSIONS - Added for reCAPTCHA core extension.
Return values
array<string|int, mixed>getVar()
public
getVar(string $name) : mixed
- use of this function assumes that an otherwise unavailable variable can be used form outside the class in question. However, the very fact it is otherwise unavailable means there is no contract that it will not be changed or become unused. This function is OK for temporary usage but should be accompanied with an effort to establish a more correct method or property tested hook / api interface if this is being done from outside of core.
Parameters
- $name : string
isFormInEditMode()
Is the form in edit mode.
public
isFormInEditMode() : bool
Helper function, notably for extensions implementing the buildForm hook, so that they can return early.
Return values
boolisFormInViewMode()
Is the form in view mode.
public
isFormInViewMode() : bool
Helper function, notably for extensions implementing the buildForm hook, so that they can return early.
Return values
boolisPayLater()
public
isPayLater() : bool
Return values
boolisQuickConfig()
Is the price set quick config.
public
isQuickConfig() : bool
Return values
boolisTest()
Is the form being submitted in test mode.
public
isTest() : bool
Return values
boolmainProcess()
Main process wrapper.
public
mainProcess([bool $allowAjax = TRUE ]) : mixed
Implemented so that we can call all the hook functions.
Parameters
- $allowAjax : bool = TRUE
-
FIXME: This feels kind of hackish, ideally we would take the json-related code from this function. and bury it deeper down in the controller
overrideExtraTemplateFileName()
Add the extra.tpl in.
public
overrideExtraTemplateFileName() : string
Default extra tpl file basically just replaces .tpl with .extra.tpl i.e. we do not override - why isn't this done at the CRM_Core_Form level?
Return values
stringpostProcess()
Process the form.
public
postProcess() : mixed
postProcessHook()
The postProcess hook is typically called by the framework.
public
postProcessHook() : mixed
However in a few cases, the form exits or redirects early in which case it needs to call this function so other modules can do the needful Calling this function directly should be avoided if possible. In general a better way is to do setUserContext so the framework does the redirect
preProcess()
Set variables up before form is built.
public
preProcess() : mixed
preventAjaxSubmit()
Sets form attribute.
public
preventAjaxSubmit() : mixed
Tags
processAmountAndGetAutoRenew()
Wrapper for processAmount that also sets autorenew.
public
processAmountAndGetAutoRenew(array<string|int, mixed> &$params) : mixed
Parameters
- $params : array<string|int, mixed>
-
Params reflecting form input e.g with fields 'price_5' => 7, 'price_8' => array(7, 8)
processConfirm()
Process payment after confirmation.
public
processConfirm(array<string|int, mixed> &$paymentParams, int $contactID, int $financialTypeID, bool $isTest, bool $isRecur) : array<string|int, mixed>
Parameters
- $paymentParams : array<string|int, mixed>
-
Array with payment related key. value pairs
- $contactID : int
-
Contact id.
- $financialTypeID : int
-
Financial type id.
- $isTest : bool
- $isRecur : bool
Tags
Return values
array<string|int, mixed> —associated array
processOnBehalfOrganization()
Add on behalf of organization and it's location.
public
static processOnBehalfOrganization(array<string|int, mixed> &$behalfOrganization, int &$contactID, array<string|int, mixed> &$values, array<string|int, mixed> &$params[, array<string|int, mixed> $fields = NULL ]) : mixed
This situation occurs when on behalf of is enabled for the contribution page and the person signing up does so on behalf of an organization.
Parameters
- $behalfOrganization : array<string|int, mixed>
-
array of organization info.
- $contactID : int
-
individual contact id. One. who is doing the process of signup / contribution.
- $values : array<string|int, mixed>
-
form values array.
- $params : array<string|int, mixed>
- $fields : array<string|int, mixed> = NULL
-
Array of fields from the onbehalf profile relevant to the organization.
processPcp()
Function used to se pcp related defaults / params.
public
static processPcp(CRM_Core_Form &$page, array<string|int, mixed> $params) : array<string|int, mixed>
This is used by contribution and also event PCPs
Parameters
- $page : CRM_Core_Form
-
Form object.
- $params : array<string|int, mixed>
Return values
array<string|int, mixed>registerFileField()
Register a field with quick form as supporting a file upload.
public
registerFileField(array<string|int, mixed> $fieldNames) : void
Parameters
- $fieldNames : array<string|int, mixed>
registerRules()
Register all the standard rules that most forms potentially use.
public
registerRules() : mixed
removeFileRequiredRules()
public
removeFileRequiredRules(mixed $elementName) : mixed
Parameters
- $elementName : mixed
resetValues()
public
resetValues() : mixed
set()
Store the variable with the value in the form scope.
public
set(string $name, mixed $value) : mixed
Parameters
- $name : string
-
Name of the variable.
- $value : mixed
-
Value of the variable.
setAction()
Setter for action.
public
setAction(int $action) : mixed
Parameters
- $action : int
-
The mode we want to set the form.
setContext()
Set context variable.
public
setContext() : mixed
setDefaultValues()
Set default values for the form.
public
setDefaultValues() : array<string|int, mixed>
Note that in edit/view mode the default values are retrieved from the database
Return values
array<string|int, mixed> —reference to the array of default values
setFormAmountFields()
This function sets the fields.
public
setFormAmountFields(int $priceSetID) : mixed
The results of it are likely unused.
- $this->_params['amount_level']
- $this->_params['selectMembership'] And under certain circumstances sets $this->_params['amount'] = null;
Parameters
- $priceSetID : int
setIsPayLater()
public
setIsPayLater(bool $isPayLater) : mixed
Parameters
- $isPayLater : bool
setLineItems()
Set the selected line items.
public
setLineItems(mixed $lineItems) : void
This returns all selected line items, even if they will be split to a secondary contribution.
Parameters
- $lineItems : mixed
setOptions()
Setter function for options.
public
setOptions(mixed $options) : mixed
Parameters
- $options : mixed
setPageTitle()
Sets page title based on entity and action.
public
setPageTitle([string|null $entityLabel = NULL ]) : void
Parameters
- $entityLabel : string|null = NULL
Tags
setPayLaterLabel()
public
setPayLaterLabel(string $payLaterLabel) : mixed
Parameters
- $payLaterLabel : string
setPaymentMode()
Set the payment mode ('live' or 'test')
public
setPaymentMode() : mixed
setPriceFieldMetaData()
Set price field metadata.
public
setPriceFieldMetaData(array<string|int, mixed> $metadata) : void
Parameters
- $metadata : array<string|int, mixed>
setPurifiedDefaults()
public
setPurifiedDefaults(mixed $defaults) : mixed
Parameters
- $defaults : mixed
setSelectedChild()
Set the active tab
public
setSelectedChild([string $default = NULL ]) : mixed
Parameters
- $default : string = NULL
Tags
setTitle()
Setter function for title.
public
setTitle(string $title) : mixed
Parameters
- $title : string
-
The title of the form.
setVar()
public
setVar(string $name, mixed $value) : mixed
- use of this function assumes that an otherwise unavailable variable can be used form outside the class in question. However, the very fact it is otherwise unavailable means there is no contract that it will not be changed or become unused. This function is OK for temporary usage but should be accompanied with an effort to establish a more correct method or property tested hook / api interface if this is being done from outside of core.
Parameters
- $name : string
- $value : mixed
submit()
Submit function.
public
static submit(array<string|int, mixed> $params) : mixed
Parameters
- $params : array<string|int, mixed>
Tags
toSmarty()
Render form and return contents.
public
toSmarty() : string
Return values
stringunitTestAccessTolegacyProcessMembership()
Temporary function to allow unit tests to access function being refactored away.
public
static unitTestAccessTolegacyProcessMembership(int $contactID, int $membershipTypeID[, int $membershipID = NULL ]) : array<string|int, mixed>
Parameters
- $contactID : int
- $membershipTypeID : int
- $membershipID : int = NULL
Tags
Return values
array<string|int, mixed>validate()
Performs the server side validation.
public
validate() : bool
Tags
Return values
bool —true if no error found
validateMandatoryFields()
Helper function to verify that required fields have been filled.
public
static validateMandatoryFields(array<string|int, mixed> $fields, array<string|int, mixed> $values, array<string|int, mixed> &$errors) : mixed
Typically called within the scope of a FormRule function
Parameters
- $fields : array<string|int, mixed>
- $values : array<string|int, mixed>
- $errors : array<string|int, mixed>
wrangleFinancialTypeID()
Wrangle financial type ID.
public
wrangleFinancialTypeID(int $financialTypeID) : null|string
This wrangling of the financialType ID was happening in a shared function rather than in the form it relates to & hence has been moved to that form Pledges are not relevant to the membership code so that portion will not go onto the membership form.
Comments from previous refactor indicate doubt as to what was going on.
Parameters
- $financialTypeID : int
Return values
null|stringaddPaymentProcessorFieldsToForm()
Adds in either a set of radio buttons or hidden fields to contain the payment processors on a front end form
protected
addPaymentProcessorFieldsToForm() : mixed
alterLineItemsForTemplate()
Alter line items for template.
protected
alterLineItemsForTemplate(array<string|int, mixed> &$tplLineItems) : mixed
This is an early cut of what will ideally eventually be a hooklike call to the CRM_Invoicing_Utils class with a potential end goal of moving this handling to an extension.
Parameters
- $tplLineItems : array<string|int, mixed>
assignLineItemsToTemplate()
Assign line items to the template.
protected
assignLineItemsToTemplate(array<string|int, mixed> $tplLineItems) : mixed
Parameters
- $tplLineItems : array<string|int, mixed>
assignPaymentProcessor()
This if a front end form function for setting the payment processor.
protected
assignPaymentProcessor(bool $isPayLaterEnabled) : mixed
It would be good to sync it with the back-end function on abstractEditPayment & use one everywhere.
Parameters
- $isPayLaterEnabled : bool
Tags
assignTotalAmounts()
Assign the total amounts for display on Confirm and ThankYou pages.
protected
assignTotalAmounts() : void
These values are used in the separate payments section.
Tags
bounceOnError()
Bounce the user back to retry when an error occurs.
protected
bounceOnError(string $message) : void
Parameters
- $message : string
buildPremiumsBlock()
Build Premium Block im Contribution Pages.
protected
buildPremiumsBlock([bool $formItems = FALSE ][, string $selectedOption = NULL ]) : void
Parameters
- $formItems : bool = FALSE
- $selectedOption : string = NULL
Tags
compileErrorMessage()
Turn array of errors into message string.
protected
compileErrorMessage(array<string|int, mixed> $errors) : string
Parameters
- $errors : array<string|int, mixed>
Return values
stringdefineRenewalMembership()
protected
defineRenewalMembership() : void
doMembershipProcessing()
Membership processing section.
protected
doMembershipProcessing(int $contactID, array<string|int, mixed> $membershipParams, array<string|int, mixed> $premiumParams) : mixed
This is in a separate function as part of a move towards refactoring.
Parameters
- $contactID : int
- $membershipParams : array<string|int, mixed>
- $premiumParams : array<string|int, mixed>
formatParamsForPaymentProcessor()
Format the fields in $this->_params for the payment processor.
protected
formatParamsForPaymentProcessor(array<string|int, mixed> $fields) : array<string|int, mixed>
In order to pass fields to the payment processor in a consistent way we add some renamed parameters.
Parameters
- $fields : array<string|int, mixed>
Return values
array<string|int, mixed>getApiAction()
Based on form action, return a string representing the api action.
protected
getApiAction() : mixed
Used by addField method.
Return string
getAuthenticatedCheckSumContactID()
Get the contact ID authenticated as a valid by checksum.
protected
getAuthenticatedCheckSumContactID() : int
Tags
Return values
intgetAvailablePaymentProcessorIDS()
Get the payment processor IDs available on the form.
protected
getAvailablePaymentProcessorIDS() : false|array<string|int, mixed>
Return values
false|array<string|int, mixed>getAvailablePaymentProcessors()
Get the payment processors that are available on the form.
protected
getAvailablePaymentProcessors() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getContactIDIfAccessingOwnRecord()
Get the contact if from the url, using the checksum or the cid if it is the logged in user.
protected
getContactIDIfAccessingOwnRecord() : int|false
use getAuthenticatedContactID()
This function returns the user being validated. It is not intended to get another user they have permission to (setContactID does do that) and can be used to check if the user is accessing their own record.
Tags
Return values
int|falsegetExistingContributionID()
Get the id of an existing contribution the submitter is attempting to pay.
protected
getExistingContributionID() : int|null
Return values
int|nullgetExistingContributionLineItems()
protected
getExistingContributionLineItems() : array<string|int, mixed>
Return values
array<string|int, mixed>getFieldsToExcludeFromPurification()
Override this in a subclass to prevent fields intended to contain "raw html" from getting broken. E.g. system message templates
protected
getFieldsToExcludeFromPurification() : array<string|int, mixed>
Return values
array<string|int, mixed>getLineItemsForMembershipCreate()
Get the line items for the membership create call.
protected
getLineItemsForMembershipCreate(int $membershipTypeID, int $defaultMembershipTypeID) : array<string|int, mixed>
This form follows a legacy code path - rather than creating the membership and then creating the contribution / order with the right line items it creates the contribution and then the membership & uses some old code in the membership BAO to create the line items. In order to do this it needs to separate out the line items into the separate membership create calls. However, any non-membership lines need to be assigned to one & only one of these line item splits.
Where we have separate payments enabled then we should ignore any non-membership line items as they will have been processed as part of the non-membership contribution.
Parameters
- $membershipTypeID : int
- $defaultMembershipTypeID : int
Tags
Return values
array<string|int, mixed>getMainContributionAmount()
Get the amount for the main contribution.
protected
getMainContributionAmount() : float
If there is a separate membership contribution this is the 'other one'. Otherwise there is only one.
Tags
Return values
floatgetMainContributionAmountLevel()
Get the amount level description for the main contribution.
protected
getMainContributionAmountLevel() : string
If there is a separate membership contribution this is the 'other one'. Otherwise there is only one.
Tags
Return values
stringgetMembershipBlock()
Get the membership block configured for the page, fetching if needed.
protected
getMembershipBlock() : array<string|int, mixed>|false
The membership block is configured memberships are available to purchase via a quick-config price set.
Return values
array<string|int, mixed>|falsegetOrder()
protected
getOrder() : CRM_Financial_BAO_Order
Return values
CRM_Financial_BAO_OrdergetPaymentProcessorObject()
Get the payment processor object for the submission, returning the manual one for offline payments.
protected
getPaymentProcessorObject() : CRM_Core_Payment
Return values
CRM_Core_PaymentgetPaymentProcessorTitle()
Get the title of the payment processor to display to the user Note: There is an identical function in CRM_Core_Payment
protected
getPaymentProcessorTitle(array<string|int, mixed> $processor) : string
Parameters
- $processor : array<string|int, mixed>
Return values
stringgetPcpID()
Get the PCP ID being contributed to.
protected
getPcpID() : int|null
Return values
int|nullgetProcessors()
Get the configured processors, including the pay later processor.
protected
getProcessors() : array<string|int, mixed>
Return values
array<string|int, mixed>getProductID()
protected
getProductID() : int|bool
Return values
int|boolgetRenewalMembershipID()
Get the id of the membership the contact is trying to renew.
protected
getRenewalMembershipID() : bool|int
Tags
Return values
bool|intgetSubmittableFields()
Get the fields that can be submitted in this form flow.
protected
getSubmittableFields() : array<string|int, string>
This is overridden to make the fields submitted on the first form (Contribution_Main) available from the others in the same flow (Contribution_Confirm, Contribution_ThankYou).
Return values
array<string|int, string>handlePreApproval()
Handle pre approval for processors.
protected
handlePreApproval(array<string|int, mixed> &$params) : mixed
This fits with the flow where a pre-approval is done and then confirmed in the next stage when confirm is hit.
This function is shared between contribution & event forms & this is their common class.
However, this should be seen as an in-progress refactor, the end goal being to also align the backoffice forms that action payments.
Parameters
- $params : array<string|int, mixed>
initializeOrder()
protected
initializeOrder() : void
isFormInViewOrEditMode()
Is the form in view or edit mode.
protected
isFormInViewOrEditMode() : bool
The 'addField' function relies on the form action being one of a set list of actions. Checking for these allows for an early return.
Return values
boolisMembershipPriceSet()
Is a (non-quick-config) membership price set in use.
protected
isMembershipPriceSet() : bool
Return values
boolisPaymentTransaction()
Is a payment being made.
protected
static isPaymentTransaction(CRM_Core_Form $form) : bool
Note that setting is_monetary on the form is somewhat legacy and the behaviour around this setting is confusing. It would be preferable to look for the amount only (assuming this cannot refer to payment in goats or other non-monetary currency
Parameters
- $form : CRM_Core_Form
Return values
boolisSeparateMembershipPayment()
Is the contribution page configured for 2 payments, one being membership & one not.
protected
isSeparateMembershipPayment() : bool
Return values
boolisSeparateMembershipTransaction()
Are we going to do 2 financial transactions.
protected
isSeparateMembershipTransaction() : bool
Ie the membership block supports a separate transactions AND the contribution form has been configured for a contribution transaction AND a membership transaction AND the payment processor supports double financial transactions (ie. NOT doTransferCheckout style)
Tags
Return values
boolisSeparatePaymentSelected()
Is the form separate payment AND has the user selected 2 options, resulting in 2 payments.
protected
isSeparatePaymentSelected() : bool
Tags
Return values
boolisShowMembershipBlock()
Should the membership block be displayed.
protected
isShowMembershipBlock() : bool
This should be shown when a membership is available to purchase.
It could be a quick config price set or a standard price set that extends CiviMember.
Return values
boollegacyProcessMembership()
Interim function for processing memberships - this is being refactored out of existence.
protected
static legacyProcessMembership(int $contactID, int $membershipTypeID, bool $is_test, string $changeToday, int $modifiedID, mixed $customFieldsFormatted, mixed $numRenewTerms, int $membershipID, mixed $pending, int $contributionRecurID, mixed $membershipSource, mixed $isPayLater[, array<string|int, mixed> $memParams = [] ][, null|CRM_Contribute_BAO_Contribution $contribution = NULL ][, array<string|int, mixed> $lineItems = [] ]) : array<string|int, mixed>
Parameters
- $contactID : int
- $membershipTypeID : int
- $is_test : bool
- $changeToday : string
- $modifiedID : int
- $customFieldsFormatted : mixed
- $numRenewTerms : mixed
- $membershipID : int
- $pending : mixed
- $contributionRecurID : int
- $membershipSource : mixed
- $isPayLater : mixed
- $memParams : array<string|int, mixed> = []
- $contribution : null|CRM_Contribute_BAO_Contribution = NULL
- $lineItems : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed>postProcessMembership()
Process the Memberships.
protected
postProcessMembership(array<string|int, mixed> $membershipParams, int $contactID, array<string|int, mixed> $premiumParams, null $customFieldsFormatted, array<string|int, mixed> $membershipDetails, array<string|int, mixed> $membershipTypeIDs, bool $isPaidMembership, array<string|int, mixed> $membershipID, int $financialTypeID) : mixed
Parameters
- $membershipParams : array<string|int, mixed>
-
Array of membership fields.
- $contactID : int
-
Contact id.
- $premiumParams : array<string|int, mixed>
- $customFieldsFormatted : null
- $membershipDetails : array<string|int, mixed>
- $membershipTypeIDs : array<string|int, mixed>
- $isPaidMembership : bool
- $membershipID : array<string|int, mixed>
- $financialTypeID : int
-
Line items for payment options chosen on the form.
Tags
postProcessPremium()
Process the form.
protected
postProcessPremium(array<string|int, mixed> $premiumParams, CRM_Contribute_BAO_Contribution $contribution) : mixed
Parameters
- $premiumParams : array<string|int, mixed>
- $contribution : CRM_Contribute_BAO_Contribution
prepareParamsForPaymentProcessor()
Format the fields in $params for the payment processor.
protected
prepareParamsForPaymentProcessor(array<string|int, mixed> $params) : array<string|int, mixed>
In order to pass fields to the payment processor in a consistent way we add some renamed parameters.
Parameters
- $params : array<string|int, mixed>
-
Payment processor params
Return values
array<string|int, mixed> —$params
preProcessPaymentOptions()
Handle Payment Processor switching for contribution and event registration forms.
protected
preProcessPaymentOptions() : mixed
This function is shared between contribution & event forms & this is their common class.
However, this should be seen as an in-progress refactor, the end goal being to also align the backoffice forms that action payments.
This function overlaps assignPaymentProcessor, in a bad way.
processFormContribution()
Process the contribution.
protected
processFormContribution(array<string|int, mixed> $params, array<string|int, mixed> $result, array<string|int, mixed> $contributionParams, CRM_Financial_DAO_FinancialType $financialType, bool $isRecur) : CRM_Contribute_DAO_Contribution
Parameters
- $params : array<string|int, mixed>
- $result : array<string|int, mixed>
- $contributionParams : array<string|int, mixed>
-
Parameters to be passed to contribution create action. This differs from params in that we are currently adding params to it and 1) ensuring they are being passed consistently & 2) documenting them here.
- contact_id
- line_item
- is_test
- campaign_id
- contribution_page_id
- source
- payment_type_id
- thankyou_date (not all forms will set this)
- $financialType : CRM_Financial_DAO_FinancialType
- $isRecur : bool
-
Is this recurring?
Tags
Return values
CRM_Contribute_DAO_ContributionprocessFormSubmission()
Post form submission handling.
protected
processFormSubmission(int $contactID) : array<string|int, mixed>
This is also called from the test suite.
Parameters
- $contactID : int
Tags
Return values
array<string|int, mixed>processMembership()
Process membership.
protected
processMembership(array<string|int, mixed> $membershipParams, int $contactID, array<string|int, mixed> $customFieldsFormatted, array<string|int, mixed> $premiumParams) : void
Parameters
- $membershipParams : array<string|int, mixed>
- $contactID : int
- $customFieldsFormatted : array<string|int, mixed>
- $premiumParams : array<string|int, mixed>
pushUrlToUserContext()
Push path to the userContext (defaults to current url path).
protected
pushUrlToUserContext([string|null $path = NULL ]) : void
This is like a save point :-). The next status bounce will return the browser to this url unless another is added.
Parameters
- $path : string|null = NULL
-
Path string e.g.
civicrm/foo/bar?reset=1
, defaults to current path.
setContactID()
Get contact iD for a form object.
protected
setContactID() : null|int
This checks the requestedContactID and returns it if
- it is the number 0 (relevant for online contribution & event forms).
- it is the logged in user
- it is validated by a checksum in the url.
- it is a contact that the logged in user has permission to view
Failing that it returns the logged in user, if any. This is may be useful for users taking actions from their contact dashboard (although usually one of the variants above would be hit).
Tags
Return values
null|intsetRecurringMembershipParams()
Determine if recurring parameters need to be added to the form parameters.
protected
setRecurringMembershipParams() : mixed
- is_recur
- frequency_interval
- frequency_unit
For membership this is based on the membership type.
This needs to be done before processing the pre-approval redirect where relevant on the main page or before any payment processing.
Arguably the form should start to build $this->_params in the pre-process main page & use that array consistently throughout.
setTranslatedFields()
Set translated fields.
protected
setTranslatedFields() : mixed
This function is called from the class constructor, allowing us to set fields on the class that can't be set as properties due to need for translation or other non-input specific handling.
validateAuthenticatedCheckSumContactID()
Verify that a contact ID is authenticated as a valid contact by checksum
protected
validateAuthenticatedCheckSumContactID(int|null $contactID) : int
Parameters
- $contactID : int|null
Tags
Return values
intauthenticatePledgeUser()
Authenticate pledge user during online payment.
private
authenticatePledgeUser() : void
Tags
buildMembershipBlock()
Build Membership Block in Contribution Pages.
private
buildMembershipBlock(int $cid[, int|array<string|int, mixed> $selectedMembershipTypeID = NULL ][, null $isTest = NULL ]) : bool
Parameters
- $cid : int
-
Contact checked for having a current membership for a particular membership.
- $selectedMembershipTypeID : int|array<string|int, mixed> = NULL
-
Selected membership id.
- $isTest : null = NULL
Tags
Return values
bool —Is this a separate membership payment
formatReferenceFieldAttributes()
private
formatReferenceFieldAttributes(array<string|int, mixed> &$props, string $formName) : mixed
Parameters
- $props : array<string|int, mixed>
- $formName : string
getContributionParams()
Set the parameters to be passed to contribution create function.
private
getContributionParams(array<string|int, mixed> $params, int $financialTypeID, string $receiptDate, int $recurringContributionID) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
- $financialTypeID : int
- $receiptDate : string
- $recurringContributionID : int
Tags
Return values
array<string|int, mixed>getMembershipParamsFromPriceSet()
Extract the selected memberships from a priceSet
private
getMembershipParamsFromPriceSet(array<string|int, mixed> $membershipParams) : array<string|int, mixed>
Parameters
- $membershipParams : array<string|int, mixed>
Return values
array<string|int, mixed>getNonDeductibleAmount()
Get non-deductible amount.
private
getNonDeductibleAmount(array<string|int, mixed> $params, CRM_Financial_BAO_FinancialType $financialType, bool $online) : array<string|int, mixed>
This is a bit too much about wierd form interpretation to be this deep.
Parameters
- $params : array<string|int, mixed>
- $financialType : CRM_Financial_BAO_FinancialType
- $online : bool
Tags
Return values
array<string|int, mixed>handlePledge()
Previously shared code.
private
handlePledge(mixed &$form, mixed $params, mixed $contributionParams, mixed $pledgeID, mixed $contribution, mixed $isEmailReceipt) : mixed
Parameters
- $form : mixed
- $params : mixed
- $contributionParams : mixed
- $pledgeID : mixed
- $contribution : mixed
- $isEmailReceipt : mixed
initSet()
Initiate price set such that various non-BAO things are set on the form.
private
initSet(CRM_Core_Form $form) : mixed
This function is not really a BAO function so the location is misleading.
Parameters
- $form : CRM_Core_Form
-
Form entity id.
Tags
isMembershipSelected()
Return True/False if we have a membership selected on the contribution page
private
isMembershipSelected() : bool
Return values
boolpreProcessChainSelectFields()
Set options and attributes for chain select fields based on the controlling field's value
private
preProcessChainSelectFields() : mixed
processRecurringContribution()
Create the recurring contribution record.
private
processRecurringContribution(array<string|int, mixed> $params, array<string|int, mixed> $recurParams) : int|null
Parameters
- $params : array<string|int, mixed>
- $recurParams : array<string|int, mixed>
Return values
int|nullprocessSecondaryFinancialTransaction()
Where a second separate financial transaction is supported we will process it here.
private
processSecondaryFinancialTransaction(int $contactID, array<string|int, mixed> $tempParams, bool $isTest, mixed $minimumFee, int $financialTypeID) : array<string|int, array<string|int, mixed>>
Parameters
- $contactID : int
- $tempParams : array<string|int, mixed>
- $isTest : bool
- $minimumFee : mixed
- $financialTypeID : int
Tags
Return values
array<string|int, array<string|int, mixed>>selectOrAnyPlaceholder()
Handles a repeated bit supplying a placeholder for entity selection
private
static selectOrAnyPlaceholder(string $props, bool $required[, string $title = NULL ]) : string
Parameters
- $props : string
-
The field properties, including the entity and context.
- $required : bool
-
If the field is required.
- $title : string = NULL
-
A field title, if applicable.
Return values
string —The placeholder text.
validateChainSelectFields()
Validate country / state / county match and suppress unwanted "required" errors
private
validateChainSelectFields() : mixed