-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix e-notices on Address settings page, convert YesNo field #13004
Fix e-notices on Address settings page, convert YesNo field #13004
Conversation
(Standard links)
|
@eileenmcnaughton Needs rebase (conflict) |
CRM/Admin/Form/SettingTrait.php
Outdated
@@ -171,9 +171,13 @@ protected function addFieldsDefinedInSettingsMetadata() { | |||
elseif ($add == 'addMonthDay') { | |||
$this->add('date', $setting, ts($props['title']), CRM_Core_SelectValues::date(NULL, 'M d')); | |||
} | |||
elseif ($add === 'addYesNo' && ($props['type'] === 'Boolean')) { | |||
$this->addRadio($setting, ts($props['title']), array(0 => 'No', 1 => 'Yes'), NULL, ' '); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most YesNo fields are displayed with Yes as the first element (see Settings -> Search Preferences and custom fields of type YesNo).
Can we flip this array so Yes is shown first on the UI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@eileenmcnaughton needs rebase again now |
This fixes enotices & also does our first preferences conversion of a YesNo / Radio field
0eb9cbc
to
c7cd4e2
Compare
@mattwire @seamuslee001 this is now updated - note I had to change the url rule to not fail an empty value - I think that is sensible because the rule is checking value validity but the responsibility for checking presentness is elsewhere |
I've tested this locally and I am happy that it is working. There is an issue with redirecting away from the page when validation fails on the URL but this was present before the changes. Merge on pass |
Overview
This fixes enotices
Before
After
Technical Details
We are converging the logic for handling settings on settings form into the SettingTrait - which is used by both Settings forms & Preferences. The difference between settings forms & preferences is arbitrary & historical & we are working to eliminate it. The final trait will be usable by extensions too. In fixing this e-notice I am also converting one of the fields over
@mattwire in doing this I wanted to look at your proposed changes here
https://github.com/civicrm/civicrm-core/pull/12932/files#diff-cd9367d6c33a74944159c2f7623db4a7R189 where you suggest changing html_type from 'radio' to 'YesNo' - my take on this is that the Quickform type is a quickform specific thing (like YesNo) but the html_type is a generic html type of element - I note this is NOT clearly documented & the docs treat html_type as a sub element of QF type. I suggest we discuss here & agree & then add a list of valid options here https://docs.civicrm.org/dev/en/latest/framework/setting/
Also I note that with the SettingTrait currently gives preference to quick_form_type & then handles html_type
Comments
I don't think the discussion needs to block merge here - I think this is mergeable & discussion can continue