function WebformCivicrmBase::__get in Webform CiviCRM Integration 8.5
Magic method to retrieve otherwise inaccessible properties
Parameters
$name:
Return value
mixed
Throws
Exception
File
- src/
WebformCivicrmBase.php, line 49 - Front-end form handler base class.
Class
- WebformCivicrmBase
- Class WebformCivicrmBase
Namespace
Drupal\webform_civicrmCode
function __get($name) {
$utils = \Drupal::service('webform_civicrm.utils');
switch ($name) {
case 'payment_processor':
$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 = $utils
->wf_civicrm_api('payment_processor', 'getsingle', [
'id' => $payment_processor_id,
]);
}
return $this->_payment_processor;
case 'tax_rate':
$taxSettings = $utils
->wf_crm_get_civi_setting('contribution_invoice_settings');
if (is_array($taxSettings) && !empty($taxSettings['invoicing'])) {
$contribution_enabled = wf_crm_aval($this->data, 'contribution:1:contribution:1:enable_contribution');
if ($contribution_enabled) {
// tax integration
$taxRates = \CRM_Core_PseudoConstant::getTaxRates();
$ft = wf_crm_aval($this->data, 'contribution:1:contribution:1:financial_type_id');
$this->_tax_rate = $taxRates[$ft] ?? NULL;
}
return $this->_tax_rate;
}
return NULL;
case 'civicrm_version':
return \CRM_Utils_System::version();
default:
throw new Exception('Unknown property');
}
}