function wf_crm_webform_base::__get in Webform CiviCRM Integration 7.5
Same name and namespace in other branches
- 7.4 includes/wf_crm_webform_base.inc \wf_crm_webform_base::__get()
Magic method to retrieve otherwise inaccessible properties
Parameters
$name:
Return value
mixed
Throws
Exception
File
- includes/
wf_crm_webform_base.inc, line 45
Class
- wf_crm_webform_base
- Class wf_crm_webform_base
Code
function __get($name) {
switch ($name) {
case 'payment_processor':
$this
->fixPaymentProcessorID();
$payment_processor_id = wf_crm_aval($this->data, 'contribution:1:contribution:1:payment_processor_id');
if ($payment_processor_id && !$this->_payment_processor) {
$this->_payment_processor = wf_civicrm_api('payment_processor', 'getsingle', [
'id' => $payment_processor_id,
]);
}
return $this->_payment_processor;
case 'contribution_page':
$contribution_page_id = wf_crm_aval($this->data, 'contribution:1:contribution:1:contribution_page_id');
if ($contribution_page_id && !$this->_contribution_page) {
$this->_contribution_page = wf_civicrm_api('contribution_page', 'getsingle', [
'id' => $contribution_page_id,
]);
}
return $this->_contribution_page;
case 'tax_rate':
$taxSettings = wf_crm_get_civi_setting('contribution_invoice_settings');
if (is_array($taxSettings) && !empty($taxSettings['invoicing'])) {
if ($this->contribution_page) {
// tax integration
$taxRates = CRM_Core_PseudoConstant::getTaxRates();
$this->_tax_rate = isset($taxRates[$this->_contribution_page['financial_type_id']]) ? $taxRates[$this->_contribution_page['financial_type_id']] : NULL;
}
return $this->_tax_rate;
}
return NULL;
case 'civicrm_version':
return CRM_Utils_System::version();
default:
throw new Exception('Unknown property');
}
}