$this->add('text', 'total_amount', ts('Total Amount'), ['readonly' => TRUE], FALSE);
}
$pps = $this->getProcessors();
-
+ $optAttributes = [];
+ foreach ($pps as $ppKey => $ppval) {
+ if ($ppKey > 0) {
+ $optAttributes[$ppKey]['class'] = 'payment_processor_' . strtolower($this->_paymentProcessors[$ppKey]['payment_processor_type']);
+ }
+ else {
+ $optAttributes[$ppKey]['class'] = 'payment_processor_paylater';
+ }
+ }
if (count($pps) > 1) {
$this->addRadio('payment_processor_id', ts('Payment Method'), $pps,
- NULL, " "
+ NULL, " ", FALSE, $optAttributes
);
}
elseif (!empty($pps)) {
* @param array $attributes
* @param null $separator
* @param bool $required
+ * @param array $optionAttributes - Option specific attributes
*
* @return HTML_QuickForm_group
*/
- public function &addRadio($name, $title, $values, $attributes = [], $separator = NULL, $required = FALSE) {
+ public function &addRadio($name, $title, $values, $attributes = [], $separator = NULL, $required = FALSE, $optionAttributes = []) {
$options = [];
$attributes = $attributes ? $attributes : [];
$allowClear = !empty($attributes['allowClear']);
unset($attributes['allowClear']);
$attributes['id_suffix'] = $name;
foreach ($values as $key => $var) {
- $options[] = $this->createElement('radio', NULL, NULL, $var, $key, $attributes);
+ $optAttributes = $attributes;
+ if (!empty($optionAttributes[$key])) {
+ foreach ($optionAttributes[$key] as $optAttr => $optVal) {
+ if (!empty($optAttributes[$optAttr])) {
+ $optAttributes[$optAttr] .= ' ' . $optVal;
+ }
+ else {
+ $optAttributes[$optAttr] = $optVal;
+ }
+ }
+ }
+ $options[] = $this->createElement('radio', NULL, NULL, $var, $key, $optAttributes);
}
$group = $this->addGroup($options, $name, $title, $separator);
}
if ($this->_values['event']['is_monetary']) {
+ $optAttributes = [];
+ foreach ($pps as $ppKey => $ppval) {
+ if ($ppKey > 0) {
+ $optAttributes[$ppKey]['class'] = 'payment_processor_' . strtolower($this->_paymentProcessors[$ppKey]['payment_processor_type']);
+ }
+ else {
+ $optAttributes[$ppKey]['class'] = 'payment_processor_paylater';
+ }
+ }
if (count($pps) > 1) {
$this->addRadio('payment_processor_id', ts('Payment Method'), $pps,
- NULL, " "
+ NULL, " ", FALSE, $optAttributes
);
}
elseif (!empty($pps)) {