No Code Attached Yet
avatar AndySDH
AndySDH
1 Mar 2022

Follow-up for PR #36551 and issue #36548

Preamble

In that PR, the input select for list Custom Fields was improved from the raw HTML select, to being rendered with the choices.js script.

So from this:
image

to this (which is similar to what we had in J3)
image

This is great.

However, this was not implemented as a straight replacement for the old style, but as a setting under the "Options" tab when creating a list custom field, where you have to set it to "enhanced select".

Here are my comments to this:

Wrong placement of Option

Where the setting was placed, it's the wrong placement for this setting.

The "Options" tab is dedicated to global settings that are shared by all field types. It's not the place to add type-specific settings.

Options tied to specific types of fields should be added in the first "General" tab. This is what has always been done for all field types and field settings.

So this new "Form Layout" should be moved under the "General" tab. For example, under the "Multiple" setting:

image

But: Do we even need this setting at all?

I would argue: do we really need a setting? The other "raw" layout is ugly and unusable. I don't think anyone will ever want to use it.

Why have the "bad" version at all? Let alone having it by default, and the "enhanced select" behind an option?

The new one it's just better, and it's similar to what he had in J3. In J3 we straight had the chosen.js style, with no need to turn on/off an option. Here we can/should do the same by simply using the choices.js version.

I personally would just get rid of the old layout altogether, and simply implement the "enhanced select" as the only display. Like we had in J3. What do you think? @laoneo

avatar AndySDH AndySDH - open - 1 Mar 2022
avatar joomla-cms-bot joomla-cms-bot - change - 1 Mar 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 1 Mar 2022
avatar AndySDH AndySDH - change - 1 Mar 2022
The description was changed
avatar AndySDH AndySDH - edited - 1 Mar 2022
avatar AndySDH AndySDH - change - 1 Mar 2022
The description was changed
avatar AndySDH AndySDH - edited - 1 Mar 2022
avatar AndySDH AndySDH - change - 1 Mar 2022
The description was changed
avatar AndySDH AndySDH - edited - 1 Mar 2022
avatar AndySDH AndySDH - change - 1 Mar 2022
The description was changed
avatar AndySDH AndySDH - edited - 1 Mar 2022
avatar AndySDH AndySDH - change - 1 Mar 2022
Title
[4.1] [com_fields] Remove form layout options for list custom fields (use enhanced select by default)
[4.1] [com_fields] Remove form layout setting for list custom fields (use enhanced select by default)
avatar AndySDH AndySDH - edited - 1 Mar 2022
avatar AndySDH
AndySDH - comment - 19 Mar 2022

Can you help with this @laoneo ?

avatar laoneo
laoneo - comment - 19 Mar 2022

This was done due backwards compatibility. Feel free to make a pr and change it in 4.2. Problem is that on update you need to convert all the existing field when they have no value set to the old one.

avatar AndySDH
AndySDH - comment - 19 Mar 2022

If you mean the setting selection, I don't see why. My main suggestion here is to completely scrap the "raw" display. It's ugly and unusable, nobody would ever want it like that. So removing it, and only using the choices.js for all cases.

Or even if you keep the "raw" style as an alternative version, you don't need to worry about BC or converting anything to the "raw" style. Changing it/removing it would be an improvement. Nobody in the right mind would prefer the raw style ?

Joomla 3 was already using the chosen-style display, this "raw" style is only in Joomla 4 and was never in Joomla 3. So Joomla 4 actually got a downgrade with this "raw" style. There's no backward compatibility to worry about here.

I can't make a PR because I don't know what I need to change to implement this. That's why I'm asking you. Otherwise I would have made it already ?

avatar AndySDH AndySDH - change - 19 Mar 2022
The description was changed
avatar AndySDH AndySDH - edited - 19 Mar 2022
avatar AndySDH AndySDH - change - 19 Mar 2022
The description was changed
avatar AndySDH AndySDH - edited - 19 Mar 2022
avatar AndySDH AndySDH - change - 19 Mar 2022
The description was changed
avatar AndySDH AndySDH - edited - 19 Mar 2022
avatar AndySDH AndySDH - change - 19 Mar 2022
The description was changed
avatar AndySDH AndySDH - edited - 19 Mar 2022
avatar laoneo
laoneo - comment - 19 Mar 2022

But Joomla 4 was shipped with that behavior and maybe some templates are using a different select script now. When you force now the fancy select, then it can lead to conflicts. That's why it is an option with default value the old behavior in Joomla 4.

avatar AndySDH
AndySDH - comment - 19 Mar 2022

Well, I strongly doubt that there are any situations like that at all. But ok, let's work around that.

So thinking about a quick win here that doesn't cause BC break, would be at least implementing a global plugin setting for this.

So, moving this setting in the first main tab, eg, in this position:
image

And in the global settings for each field, add a default option, with the default for each field being "Use settings from Plugin". This way you can set a global preference instead of having to set it manually for each field you ever create.

image

Makes sense?

avatar laoneo
laoneo - comment - 19 Mar 2022

Yes, sounds like a solid plan.

avatar AndySDH
AndySDH - comment - 19 Mar 2022

I'm trying to create a PR for this, I should be able to do it.

avatar AndySDH AndySDH - change - 19 Mar 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-03-19 15:59:09
Closed_By AndySDH
avatar AndySDH AndySDH - close - 19 Mar 2022
avatar AndySDH
AndySDH - comment - 19 Mar 2022

Please test PR #37320 @laoneo, thank you :)

Add a Comment

Login with GitHub to post a comment