User tests: Successful: Unsuccessful:
Pull Request for Issue # .
Splits the html part (JLayout) to two files for obvious reasons:
All Switches are still there and still functional
Same as before, this is code improvement
Same as before
Yup
Status | New | ⇒ | Pending |
Category | ⇒ | Layout Libraries |
Dont forget to put a blank line at the end of the files
Some thoughts based on looking at the code (not tested yet):
Maybe it would make more sense to create a "switcher" layout and specify that layout in the XML instead of the class="switcher" we do currently. One could do the same for the btn-group but keep some B/C code here for extensions that still use the class for this. That would make the code a lot cleaner in the end I think.
I think the layout should be checked in setup()
,
First to check if the field has defined attribute layout
, then use it,
otherwise you do what you did here: use switch
or buttons
suffix.
Because, example, I want to set my layout to radio field, I set layout="blabla.my.field.radio"
, and expect that the field will use blabla/my/field/radio.php
, no matter what.
@Bakual @Fedik please don't shoot me, I just moved the existing code over two separate files, nothing fancy from me here
Afair we can already set a layout in the XML
I don't remember why this approach was chosen over the layouts. I think it had to do with B/C or something similar... But I agree the layout option is more appropriate
Because, example, I want to set my layout to radio field, I set layout="blabla.my.field.radio", and expect that the field will use blabla/my/field/radio.php, no matter what.
In such case we should leave the radio as vanilla (its a basic W3C input at the end of the day) and create new fields for button group and switcher. And deal with the possible B/C break
@dgt41 I do not want to shoot you
In such case we should leave the radio as vanilla (its a basic W3C input at the end of the day) and create new fields for button group and switcher
I think what you did is good, just need a small improvement,
we should not confuse an user, by another unexpected behavior
technically here is need only a new layout for "switcher", and clean up to the default "radio" layout
Two layouts should be enough. grouped buttons are regular radios just with additional CSS classes and a data-toggle attribute. The HTML tags structure stays the same.
So I would do just a regular radio layout with added design feature for btn groups and a switcher layout.
"native radios" and "groupped" it the same layouts, just with fancy styling,
later if no one do, I try to make a pull to what I have suggested in another PR
I agree with 3 layouts. Clearer code and easier to maintain. Dont forget I will be supporting inline and stacked radios so more simple structured layouts would make my life easier
Labels |
Added:
?
|
I have tested this item
I applied the patch and radio buttons are still there and still functional.
Also I could use a own layout file. I create a new radio button in com_content with a layout element:
<field
name="test_layout"
type="radio"
label="TEST"
class="switcher"
layout="joomla.form.field.radio.test"
default="1"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
Then create the layout file in the folder layouts/joomla/form/field/radio/ and I call it test.php
This new field was displayed with my test layout.
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
Looks like Travis is not Happy
63 | ERROR | Closing parenthesis of a multi-line function call must be on a line by itself
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-03-10 23:46:49 |
Closed_By | ⇒ | wilsonge |
Indeed. No way to know what is Yes/No, Hide/Show...
Please open a new issue with a reference to this PR as your comments get lost.
Even better
@C-Lodder this one is for you