Feature ? Language Change PR-5.1-dev Pending

User tests: Successful: Unsuccessful:

avatar AndySDH
AndySDH
19 Mar 2022

Pull Request for Issue #37162. Follow-up to PR #36551 and issue #36548.

Purpose of the PR

As discussed in #37162, this allows users to set a global preference for the HTML Select for custom fields of types: list, SQL, radio, integer.

I would have just removed the option, as the "raw" select is just ugly, but @laoneo noted that we need to keep it for Backwards Compatibility.

Summary of Changes

  • Added plugin settings for all relevant fields so that the field inherits from the global options by default (this allows users to set a global preference instead of having to set it for each field they create)
  • The global option will still use the old "raw" style by default (to keep Backwards Compatibility)
  • Implemented the same setting for the Integer field type as well (it was forgotten about in PR 36551 )
  • Renamed the option to "Form Layout" for it to be more explicative
  • Added new language strings in a shared language file to avoid duplicating them for all field types

Testing Instructions

First create the custom field:

  • Create Custom Field of type 'list' for the Content component. Make sure that the 'Multiple' setting is set to 'Yes'
  • Go to Options->Form Options: Keep the 'Form Layout' as 'Use Settings from Plugin'

Then:

  • Go to Plugin Manager, and in the plugin options for 'Fields - List', change the default 'Form Layout' option
  • Edit an article and check the form display of the field, it will change based on your selection of 'Form Layout'

Actual result BEFORE applying this Pull Request

There was no global setting to inherit from the plugin for 'Form Layout'

Expected result AFTER applying this Pull Request

There is now a global setting for 'Form Layout' that controls the default value when not specified in an individual field.

Changing the global setting will change the form layout of the field.

avatar AndySDH AndySDH - open - 19 Mar 2022
avatar AndySDH AndySDH - change - 19 Mar 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Mar 2022
Category Administration com_fields com_plugins Language & Strings Front End Plugins
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 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
Labels Added: Language Change ?
avatar AndySDH
AndySDH - comment - 19 Mar 2022

Thanks @brianteeman

avatar joomla-cms-bot joomla-cms-bot - change - 19 Mar 2022
Category Administration com_fields com_plugins Language & Strings Front End Plugins Administration com_fields Language & Strings Front End Plugins
avatar AndySDH
AndySDH - comment - 19 Mar 2022

Updated PR, please test it now guys, thanks! :)

avatar AndySDH
AndySDH - comment - 23 Mar 2022

Can you guys please test this? @brianteeman @laoneo @regularlabs

avatar laoneo
laoneo - comment - 23 Mar 2022

Can you rebase it to the 4.2-dev branch as it is a new feature?

avatar AndySDH AndySDH - change - 23 Mar 2022
Title
[4.1] Add Global Setting for Form Layout option to custom fields
[4.2] Add Global Setting for Form Layout option to custom fields
avatar AndySDH AndySDH - edited - 23 Mar 2022
avatar joomla-cms-bot joomla-cms-bot - change - 23 Mar 2022
Category Administration com_fields Language & Strings Front End Plugins Repository Administration com_fields Language & Strings Front End Plugins
avatar laoneo
laoneo - comment - 23 Mar 2022

When the next time the branch is merged from 4.1-dev into 4.2-dev, then the commits which are not from you will disappear.

avatar laoneo laoneo - change - 28 Mar 2022
Labels Added: ?
Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 28 Mar 2022
Category Administration com_fields Language & Strings Front End Plugins Repository Administration com_fields Language & Strings Front End Plugins
avatar AndySDH AndySDH - change - 28 Mar 2022
The description was changed
avatar AndySDH AndySDH - edited - 28 Mar 2022
avatar AndySDH AndySDH - change - 28 Mar 2022
The description was changed
avatar AndySDH AndySDH - edited - 28 Mar 2022
avatar AndySDH AndySDH - change - 28 Mar 2022
The description was changed
avatar AndySDH AndySDH - edited - 28 Mar 2022
avatar AndySDH AndySDH - change - 28 Mar 2022
The description was changed
avatar AndySDH AndySDH - edited - 28 Mar 2022
avatar laoneo
laoneo - comment - 28 Mar 2022

When I want to create an integer field there are untranslated strings:
image

avatar AndySDH
AndySDH - comment - 28 Mar 2022

Thank you for spotting this, sorry, please try now.

avatar laoneo
laoneo - comment - 28 Mar 2022

I have tested this item successfully on 9137eee


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37320.

avatar laoneo laoneo - test_item - 28 Mar 2022 - Tested successfully
avatar AndySDH
AndySDH - comment - 29 Mar 2022

Please test again, thanks guys!

avatar Quy
Quy - comment - 30 Mar 2022

Use Global and Use settings from Plugin have the same value.

form-layout

<select id="jform_fieldparams_form_layout" name="jform[fieldparams][form_layout]" class="form-select form-select">
	<option value="" selected="selected">Use Global</option>
	<option value="" selected="selected">Use settings from Plugin</option>
	<option value="joomla.form.field.list">HTML Select</option>
	<option value="joomla.form.field.list-fancy-select">Enhanced Select</option>
</select>
avatar AndySDH
AndySDH - comment - 30 Mar 2022

Thanks for spotting this @Quy, I guess this was due to @brianteeman suggestion of adding useglobal="true".

What is the standard practice here? Should we remove the useglobal="true" attribute, or should we remove <option value="">COM_FIELDS_FIELD_USE_GLOBAL</option> ?

I see that, for comparison, the 'multiple' field is not using useglobal="true" as an attribute.

avatar brianteeman
brianteeman - comment - 30 Mar 2022

useglobal = true should result in the select showing something like "Use Gobal (HTML Select)" which you cannot see when you have it as an option

avatar AndySDH
AndySDH - comment - 30 Mar 2022

That's interesting. Though It doesn't seem to happen from @Quy screen for some reason it seems, @Quy can you confirm?

If it works that way, we should probably also do an additional PR to cover other cases where useglobal="true" is not yet used (it doesn't seem to be implemented everywhere, maybe not for field plugins) @brianteeman

avatar Quy
Quy - comment - 31 Mar 2022

It does not display as seen in the screenshot. I would say do a separate PR for useglobal and not include it in this PR if it is available in plugins.

avatar AndySDH
AndySDH - comment - 31 Mar 2022

Thanks for the feedback. I removed useglobal="true" for now.

Please test again! Thanks!

avatar AndySDH AndySDH - change - 26 Apr 2022
Labels Added: PBF
avatar joomla-bot
joomla-bot - comment - 27 Jun 2022

This pull requests has been automatically converted to the PSR-12 coding standard.

avatar HLeithner
HLeithner - comment - 2 May 2023

This pull request has been automatically rebased to 5.0-dev.

avatar AndySDH
AndySDH - comment - 17 Jun 2023

This pull request has been automatically rebased to 5.0-dev.

So I guess this PR is scheduled for Joomla 5?

avatar crommie
crommie - comment - 26 Aug 2023

After applying the patch I get this error: Class "Joomla\Plugin\Fields\Integer\Extension\Integer" not found

avatar flo-the-cat flo-the-cat - test_item - 26 Aug 2023 - Tested unsuccessfully
avatar oshufx oshufx - test_item - 26 Aug 2023 - Tested unsuccessfully
avatar flo-the-cat
flo-the-cat - comment - 26 Aug 2023

I have tested this item ? unsuccessfully on 9137eee

Althought the patch does indeed add the required field, you cannot then use ti as adding an article is broken with the following message
Class "Joomla\Plugin\Fields\Integer\Extension\Integer" not found

Reverting the patch and you can add articles again


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37320.

avatar oshufx
oshufx - comment - 26 Aug 2023

I have tested this item ? unsuccessfully on 9137eee

This test was unsuccessful due to articles no longer being able to be created after the patch had been applied. This is the error that returned.

An error has occurred.
0 Class "Joomla\Plugin\Fields\Integer\Extension\Integer" not found


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37320.
avatar richard67
richard67 - comment - 26 Aug 2023

@crommie @flo-the-cat @oshufx The reason for the unsuccessful tests is because this PR has merge conflicts. You can see them when going to the PR and scroll to the bottom. I will try to solve them.

avatar richard67 richard67 - change - 26 Aug 2023
Labels Added: Feature PR-5.0-dev
Removed: ?
avatar flo-the-cat
flo-the-cat - comment - 26 Aug 2023

@crommie @flo-the-cat @oshufx The reason for the unsuccessful tests is because this PR has merge conflicts. You can see them when going to the PR and scroll to the bottom. I will try to solve them.

Just say when and we will retest

avatar richard67
richard67 - comment - 26 Aug 2023

Just say when and we will retest

@crommie @flo-the-cat @oshufx Ready. If you use Patchtester, just don't forget to revert this and any other PRs and then fetching the list of PRs again before applying this PR again.

avatar crommie crommie - test_item - 26 Aug 2023 - Tested successfully
avatar crommie
crommie - comment - 26 Aug 2023

I have tested this item ✅ successfully on 9137eee

Without patch:

Form layout (in options tab) has options Default and Enhanced Select
Plugin has option to enable/disable Multiple and add a Default Value for the list

With patch:

Form layout is now in the first tab and no longer in the options tab. It has options Use settings from plugin, HTML Select and Enhanced Select
Plugin has option to enable/disable Multiple, add a Default Value for the list and a dropdown to choose HTML Select or Enhanced Select


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37320.
avatar AndySDH
AndySDH - comment - 31 Aug 2023

Thanks for testing! One more test to merge :)

avatar AndySDH AndySDH - change - 10 Sep 2023
Title
[4.2] Add Global Setting for Form Layout option to custom fields
[5.0] Add Global Setting for Form Layout option to custom fields
avatar AndySDH AndySDH - edited - 10 Sep 2023
avatar AndySDH
AndySDH - comment - 10 Sep 2023

On second thoughts, I decided to undo the change of moving the form_layout setting from params to fieldparmas. For multiple reasons:

  • For backwards compatibility. Moving it to fieldparams would mean saved values would have been lost
  • It's under params for the subform, and the option is named the same. So it's best if it's consistent across all field types.
  • It's a setting shared by multiple fields, so it makes more sense to be in the Form Options

So the option has now returned once again under "Options -> Form Options", as part of the standard params.

Please re-test again, thank you :)

avatar AndySDH AndySDH - change - 10 Sep 2023
The description was changed
avatar AndySDH AndySDH - edited - 10 Sep 2023
avatar ceford
ceford - comment - 15 Sep 2023

I am afraid the test instruction are not clear enough for me to follow:
Go to Plugin Manager, and in the plugin options of 'Fields - List', change the default 'Form Layout' option
Change it to what? I have a choice of HTML Select or Enhanced Select. I created some list values here too - but that does not seem right and they are not used.

Edit an article and check the form display of the field
I get either an empty list box or an empty textarea. I don't know what I am looking for.

Testing in 5.0.0-beta2-dev


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37320.

avatar AndySDH
AndySDH - comment - 15 Sep 2023

I am afraid the test instruction are not clear enough for me to follow: Go to Plugin Manager, and in the plugin options of 'Fields - List', change the default 'Form Layout' option Change it to what? I have a choice of HTML Select or Enhanced Select. I created some list values here too - but that does not seem right and they are not used.

@ceford

Set it to "Enhanced Select" for example. When editing the field in the article, you should see this:

image

While if you set it to "HTML Select" you should see this:

image

avatar AndySDH AndySDH - change - 15 Sep 2023
The description was changed
avatar AndySDH AndySDH - edited - 15 Sep 2023
avatar ceford
ceford - comment - 18 Sep 2023

There are problems with this PR. It adds a form field to four Field Plugins: Integer, List, Radio and SQL. But the radio field has a Buttons/Switcher choice and the SQL plugin cannot be saved unless a default SQL query is entered.

Applying the patch and creating a Field of each type, when I edit an article the Fields tab gives me the following errors, before the first field:

Warning
: Undefined property: stdClass::$value in
/Users/ceford/Sites/joomla-cms/libraries/src/Form/Field/SqlField.php
on line
302


Warning
: Undefined property: stdClass::$text in
/Users/ceford/Sites/joomla-cms/libraries/src/Form/Field/SqlField.php
on line
302


Deprecated
: trim(): Passing null to parameter #1 ($string) of type string is deprecated in
/Users/ceford/Sites/joomla-cms/libraries/src/HTML/Helpers/Select.php
on line
388

For the SQL field:

 Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /Users/ceford/Sites/joomla-cms/libraries/src/HTML/Helpers/Select.php on line 557

Could be my fault for not filling out the fields properly.

avatar AndySDH
AndySDH - comment - 18 Sep 2023

Thanks for testing @ceford

the SQL plugin cannot be saved unless a default SQL query is entered.

That is a separate issue not coming from this PR. It was an issue already present. I tried to fix it as part of this PR as well, but @laoneo asked me to remove it from this PR. See: #37320 (comment)

So that is a separate issue. If it was me I would have included it here, but I didn't make the decision.

Applying the patch and creating a Field of each type, when I edit an article the Fields tab gives me the following errors, before the first field:

I can't reproduce this, I don't get these errors.

I don't think those warnings are coming from this PR. I didn't touch those files, and none of the changes I made should affect those files. I basically only made changes to XML files, so no PHP errors should be affected at all.

avatar obuisard
obuisard - comment - 19 Sep 2023

I tested every single field. None of them was getting the global settings from their associated plugin for the form layout.
When you reverted the changes (from fieldparams to formoptions), the merge of the plugin params and fieldparams had no longer any effect on form_layout.
The fix I proposed resolves that issue.

avatar AndySDH
AndySDH - comment - 19 Sep 2023

@obuisard That is extremely weird. After applying the patch, for me all fields inherit the layout from the respective global settings. I just tested it again to make sure and still worked for me. So I'm not sure why it's not working on your end.

I just applied your proposed change though. Can you please test again now? Thank you!

avatar obuisard
obuisard - comment - 19 Sep 2023

@obuisard That is extremely weird. After applying the patch, for me all fields inherit the layout from the respective global settings. I just tested it again to make sure and still worked for me. So I'm not sure why it's not working on your end.

Could be a side effect if you have not saved the fields again after the location change of the form_layout.

avatar obuisard obuisard - test_item - 19 Sep 2023 - Tested successfully
avatar obuisard
obuisard - comment - 19 Sep 2023

I have tested this item ✅ successfully on 9137eee


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37320.

avatar richard67 richard67 - alter_testresult - 19 Sep 2023 - flo-the-cat: Not tested
avatar richard67 richard67 - alter_testresult - 19 Sep 2023 - oshufx: Not tested
avatar richard67 richard67 - alter_testresult - 19 Sep 2023 - obuisard: Tested successfully
avatar AndySDH
AndySDH - comment - 19 Sep 2023

Thank you :)

avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 5.1-dev.

avatar richard67 richard67 - alter_testresult - 3 Oct 2023 - crommie: Not tested
avatar richard67 richard67 - alter_testresult - 3 Oct 2023 - obuisard: Tested successfully
avatar richard67 richard67 - alter_testresult - 3 Oct 2023 - ceford: Tested successfully
avatar richard67 richard67 - change - 3 Oct 2023
Status Pending Ready to Commit
Build 4.1-dev 5.1-dev
avatar richard67 richard67 - edited - 3 Oct 2023
avatar richard67
richard67 - comment - 3 Oct 2023

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37320.

avatar richard67 richard67 - change - 3 Oct 2023
Title
[5.0] Add Global Setting for Form Layout option to custom fields
[5.1] Add Global Setting for Form Layout option to custom fields
avatar richard67 richard67 - edited - 3 Oct 2023
avatar richard67 richard67 - change - 3 Oct 2023
Labels Added: ? PR-5.1-dev
Removed: PBF PR-5.0-dev
avatar LadySolveig LadySolveig - change - 1 Nov 2023
Labels Added: ?
Removed: ?
avatar Quy Quy - change - 2 Nov 2023
Labels Added: ?
Removed: ?
avatar LadySolveig
LadySolveig - comment - 2 Nov 2023

Many thanks for this contribution @AndySDH and the very nice teamwork!

avatar Razzo1987 Razzo1987 - change - 2 Nov 2023
Labels Added: ?
Removed: ?
avatar Razzo1987 Razzo1987 - test_item - 2 Nov 2023 - Tested successfully
avatar Razzo1987
Razzo1987 - comment - 2 Nov 2023

I have tested this item ✅ successfully on 9137eee

Very nice work! We love it!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37320.

avatar Razzo1987 Razzo1987 - close - 2 Nov 2023
avatar Razzo1987 Razzo1987 - merge - 2 Nov 2023
avatar Razzo1987 Razzo1987 - change - 2 Nov 2023
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-11-02 21:09:59
Closed_By Razzo1987
Labels Added: ?
Removed: ?

Add a Comment

Login with GitHub to post a comment