/**
* Indicate if this form should warn users of unsaved changes
+ * @var bool
*/
protected $unsavedChangesWarn;
const CB_PREFIX = 'mark_x_', CB_PREFIY = 'mark_y_', CB_PREFIZ = 'mark_z_', CB_PREFIX_LEN = 7;
/**
- * @internal to keep track of chain-select fields
* @var array
+ * @internal to keep track of chain-select fields
*/
private $_chainSelectFields = [];
// Respond with JSON if in AJAX context (also support legacy value '6')
if ($allowAjax && !empty($_REQUEST['snippet']) && in_array($_REQUEST['snippet'], [
- CRM_Core_Smarty::PRINT_JSON,
- 6,
- ])
- ) {
+ CRM_Core_Smarty::PRINT_JSON,
+ 6,
+ ])) {
$this->ajaxResponse['buttonName'] = str_replace('_qf_' . $this->getAttribute('id') . '_', '', $this->controller->getButtonName());
$this->ajaxResponse['action'] = $this->_action;
if (isset($this->_id) || isset($this->id)) {
$this->assign('bltID', $this->_bltID);
}
+ /**
+ * @return int
+ */
+ public function getPaymentProcessorID() {
+ return $this->_paymentProcessorID;
+ }
+
/**
* This if a front end form function for setting the payment processor.
*
else {
$this->_paymentProcessor = [];
}
- CRM_Financial_Form_Payment::addCreditCardJs($this->_paymentProcessorID);
}
- $this->assign('paymentProcessorID', $this->_paymentProcessorID);
+
// We save the fact that the profile 'billing' is required on the payment form.
// Currently pay-later is the only 'processor' that takes notice of this - but ideally
// 1) it would be possible to select the minimum_billing_profile_id for the contribution form
$label,
$options,
$required,
- NULL
+ ['class' => 'crm-select2']
);
$attributes = ['format' => 'searchDate'];
$extra = ['time' => $isDateTime];
$props['context'] = $this->getDefaultContext();
}
// This is not a required param, so we'll ignore if this doesn't exist.
- catch (Exception $e) {}
+ catch (Exception $e) {
+ }
}
// Fetch options from the api unless passed explicitly
if (isset($props['options'])) {
*
* @throws \CiviCRM_API3_Exception
* @throws \Exception
- * @return HTML_QuickForm_Element
+ * @return mixed
+ * HTML_QuickForm_Element
+ * void
*/
public function addField($name, $props = [], $required = FALSE, $legacyDate = TRUE) {
// Resolve context.
}
$isSelect = (in_array($widget, [
- 'Select',
- 'CheckBoxGroup',
- 'RadioGroup',
- 'Radio',
+ 'Select',
+ 'CheckBoxGroup',
+ 'RadioGroup',
+ 'Radio',
]));
if ($isSelect) {
if ($this->canUseAjaxContactLookups()) {
$this->assign('selectable', $autoCompleteField['id_field']);
$this->addEntityRef($autoCompleteField['id_field'], NULL, [
- 'placeholder' => $autoCompleteField['placeholder'],
- 'api' => $autoCompleteField['api'],
- ]);
+ 'placeholder' => $autoCompleteField['placeholder'],
+ 'api' => $autoCompleteField['api'],
+ ]);
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/AlternateContactSelector.js', 1, 'html-header')
->addSetting([
public function addChainSelect($elementName, $settings = []) {
$props = $settings += [
'control_field' => str_replace(['state_province', 'StateProvince', 'county', 'County'], [
- 'country',
- 'Country',
- 'state_province',
- 'StateProvince',
- ], $elementName),
+ 'country',
+ 'Country',
+ 'state_province',
+ 'StateProvince',
+ ], $elementName),
'data-callback' => strpos($elementName, 'rovince') ? 'civicrm/ajax/jqState' : 'civicrm/ajax/jqCounty',
'label' => strpos($elementName, 'rovince') ? ts('State/Province') : ts('County'),
'data-empty-prompt' => strpos($elementName, 'rovince') ? ts('Choose country first') : ts('Choose state first'),
$this->setConstants(['task' => '']);
$this->assign('taskMetaData', $tasks);
$select = $this->add('select', 'task', NULL, ['' => ts('Actions')], FALSE, [
- 'class' => 'crm-select2 crm-action-menu fa-check-circle-o huge crm-search-result-actions']
+ 'class' => 'crm-select2 crm-action-menu fa-check-circle-o huge crm-search-result-actions',
+ ]
);
foreach ($tasks as $key => $task) {
$attributes = [];
if (!array_intersect($targetValue, array_keys($options))) {
$this->setElementError($target, $controlType == 'country' ? ts('State/Province does not match the selected Country') : ts('County does not match the selected State/Province'));
}
- } // Suppress "required" error for field if it has no options
+ }
+ // Suppress "required" error for field if it has no options
elseif (!$options) {
$this->setElementError($target, NULL);
}