-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[4.0] Fixing switcher label for true/false #27098
Conversation
I have tested this item ✅ successfully on f17349d This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098. |
I have tested this item ✅ successfully on f17349d This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098. |
RTC. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098. |
@HLeithner |
I'm still not sure if this is the proper way to do this. But yeah if it's the best solution to resolve the problem. Shouldn't this be done in the model/formfield layer and not in the layout? |
Forget my comment I mixed 2 pr's it seams to be ok. |
In this specific case wondering if we actually should have this in the form. normally this is correct. However in the normal (non-switcher) radio field it may not be. |
Changing this in the Jformfield would mean that this is valid for all abstracted classes, that means if I have a input field I get a '0' instead of an empty string correct? (if the function is not overridden) I wouldn't expect this. |
It is checking for a |
thats true but if the value is false it would convert it also for a text field into '0' and not '' |
It is a strict comparison for boolean and false. A string value will not be affected. |
@Quy
It would have no impact? |
I am not at a computer to test but it should not be affected because it is string and not boolean. |
Also this applies to the configuration file only when storing true/false values if I am not wrong. It has been a while since doing this PR. My memory not so good these days. |
I wounder how it may have RTC 😉 Doing That maybe better to do after #27202 will be merged |
Works perfectly for me. I dont see any issues. @Fedik please post exactly where it breaks This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098. |
I have tested this item ✅ successfully on 72e779b This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098. |
I can't comment about the code but it solves the problem This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098. |
People tested it with switcher field, but this changes:
this may lead to unexpected behavior, when example some extension have a custom field, |
Took off RTC until @Fedik comment is taken care of. |
setting to pending This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098. |
@Fedik could you please provide a specific example |
I do not have a specific example to demonstrate, it a logic assumption that comes from the code review. If we need this hacky thing, then better to do it specifically for the switcher field, not global. There a couple ways: joomla-cms/layouts/joomla/form/field/radio/switcher.php Lines 73 to 77 in a9f80d6
|
Is this better? |
much better 😉 |
I mean it's grim. But much better than the initial code change. So merging. Thankyou! |
Pull Request for Issue #26749.
Summary of Changes
In Global Configuration,
0/1
are saved astrue/false
. Read #26749 (comment)false
cast as string returns empty string andtrue
returns 1.Assign it
0
so it can match the option value0
.Testing Instructions
Go to Global Configurations
See Site Offline missing label
Apply PR
Make sure switcher labels not missing
Open configuration.php
Toggle Site Offline
Make sure
$offline
is saved as true or false