From 8c83065773b4b8db71401767d15657d9f5f50287 Mon Sep 17 00:00:00 2001 From: Alice Frumin Date: Wed, 21 Jul 2021 11:03:12 -0400 Subject: [PATCH] Improve accessibility for price fields of the type select by adding the field label to the placeholder text --- CRM/Price/BAO/PriceField.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index f5435efda1..8830e97cb0 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -525,13 +525,12 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { else { $visibility_id = self::getVisibilityOptionID('public'); } - $element = &$qf->add('select', $elementName, $label, - [ - '' => ts('- select -'), - ] + $selectOption, - $useRequired && $field->is_required, - ['price' => json_encode($priceVal), 'class' => 'crm-select2', 'data-price-field-values' => json_encode($customOption)] - ); + $element = &$qf->add('select', $elementName, $label, $selectOption, $useRequired && $field->is_required, [ + 'placeholder' => ts('- select %1 -', [1 => $label]), + 'price' => json_encode($priceVal), + 'class' => 'crm-select2', + 'data-price-field-values' => json_encode($customOption), + ]); // CRM-6902 - Add "max" option for a price set field $button = substr($qf->controller->getButtonName(), -4); -- 2.25.1