Feature Conflicting Files ? PR-5.0-dev Pending

User tests: Successful: Unsuccessful:

avatar ditsuke
ditsuke
4 Oct 2021

Summary of Changes

Many extensions currently use custom status fields (PluginStatusField, RedirectStatusField, TaskStateField (from #35143)), mainly because it makes more contextual sense to use Enabled/Disabled as states at some places instead of Published/Unpublished.
This also increases scope for inconsistencies which can be seen as an example in the forms for com_workflows (reference #35056).

This PR adds alternative labels the status field which can be used with the alt_labels field attribute. This can be used in conjunction with optionsFilter at places where a list field or a custom field might be needed right now.

For example, if you want to support the enabled, disabled and trashed state for an item, you could use:

<field 
	name="state"
	type"status" 
	label="JSTATUS"
	optionsFilter="-2, 0, 1"
	alt_labels="true"
/> 

Right now, you'd have to contend with a custom field, a list field everywhere or a language override (#35743 (comment)).

Testing Instructions

You can test that StatusField (field type="status") behaves the same as before in all existing forms.
I can also add the alt_labels attribute to the workflow forms and some more places in this PR so those could be tested here and perhaps some redundant field classes removed.

Actual result BEFORE applying this Pull Request

StatusField only supports "publish" type labels.

Expected result AFTER applying this Pull Request

StatusField supports alternative state labels needed by a number of existing core extensions.

Documentation Changes Required

Update to the Form Fields/StatusField documentation on JDocs.

avatar ditsuke ditsuke - open - 4 Oct 2021
avatar ditsuke ditsuke - change - 4 Oct 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 4 Oct 2021
Category Libraries
avatar brianteeman
brianteeman - comment - 4 Oct 2021

Could you give an example please of where this would be used

avatar ditsuke
ditsuke - comment - 4 Oct 2021

Could you give an example please of where this would be used

Workflow forms (I linked a PR for reference), replacing PluginStatusField, RedirectStatusField and TaskStatusField (from Scheduler).

avatar brianteeman
brianteeman - comment - 4 Oct 2021

Personally I have always done this with just a language string

For example (together with your fix for workflows) it will look like this
image

Just by adding two language string overrides to com_workflows.ini
image

avatar ditsuke ditsuke - change - 4 Oct 2021
Labels Added: ?
avatar ditsuke
ditsuke - comment - 4 Oct 2021

Personally I have always done this with just a language string

For example (together with your fix for workflows) it will look like this image

Just by adding two language string overrides to com_workflows.ini image

That's a good solution! I think this change should still be worth considering as it might be easier perhaps to use an attribute for the safe effect as its used in quite a few places.

avatar ditsuke ditsuke - change - 4 Oct 2021
The description was changed
avatar ditsuke ditsuke - edited - 4 Oct 2021
avatar joomla-cms-bot joomla-cms-bot - change - 4 Oct 2021
Category Libraries Unit Tests Repository Administration com_content com_finder com_joomlaupdate com_tags com_users Language & Strings Modules Templates (admin) NPM Change
avatar ditsuke ditsuke - change - 4 Oct 2021
Labels Added: ? Language Change NPM Resource Changed
avatar joomla-cms-bot joomla-cms-bot - change - 4 Oct 2021
Category Unit Tests Repository Administration com_content com_finder com_joomlaupdate com_tags com_users Language & Strings Modules Templates (admin) NPM Change Libraries
avatar ditsuke
ditsuke - comment - 4 Oct 2021

Rebased to 4.1-dev

avatar richard67 richard67 - change - 13 Nov 2021
Title
[4.0] Add alternative field labels (+ a new attribute) for the Status field
[4.1] Add alternative field labels (+ a new attribute) for the Status field
avatar richard67 richard67 - edited - 13 Nov 2021
avatar ditsuke ditsuke - change - 8 Jan 2022
Labels Added: ? ?
Removed: ? Language Change ? NPM Resource Changed
avatar fancyFranci
fancyFranci - comment - 8 Jan 2022

I have tested this item successfully on 255d840

I tested the alt_labels attribute in several filters like categories and the patch worked. Enabled and Disabled showed up.


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

avatar fancyFranci fancyFranci - test_item - 8 Jan 2022 - Tested successfully
avatar HLeithner
HLeithner - comment - 27 Jun 2022

This pull request has automatically rebased to 4.2-dev.

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 - change - 27 Jun 2022
Labels Added: ?
Removed: ?
avatar Quy Quy - change - 6 Jul 2022
Labels Added: ?
Removed: ?
avatar HLeithner
HLeithner - comment - 2 May 2023

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

avatar brianteeman
brianteeman - comment - 14 Jul 2023

Looking at this again and I realise now the benefits. Together with the optionsFilter this PR would allow us to remove several fields as they would become redundant.

avatar brianteeman
brianteeman - comment - 14 Jul 2023

could someone change the title to say [5.0] instead of 4.1 please

avatar brianteeman brianteeman - test_item - 14 Jul 2023 - Tested successfully
avatar brianteeman
brianteeman - comment - 14 Jul 2023

I have tested this item successfully on bd41106


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

avatar ditsuke ditsuke - change - 14 Jul 2023
Title
[4.1] Add alternative field labels (+ a new attribute) for the Status field
[5.0] Add alternative field labels (+ a new attribute) for the Status field
avatar ditsuke ditsuke - edited - 14 Jul 2023
avatar HLeithner
HLeithner - comment - 31 Aug 2023

The proper way would be to create an addition field with other default values, then you don't need an extra attribute.

Something like StateField instead of StatusField.

avatar ceford ceford - test_item - 11 Sep 2023 - Tested successfully
avatar ceford
ceford - comment - 11 Sep 2023

I have tested this item ✅ successfully on bd41106

Tested on 5.0.0-beta2-dev. I added an extra dummy Option to see it in the filter list and also stepped through the applied code. I added two lines from the state field to the articles published field to see the effect of the alt_labels option. All works.


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

avatar richard67
richard67 - comment - 12 Sep 2023

Although it has 2 successful human tests I don't set it to RTC because it has a conflict in file "libraries/src/Form/Field/StatusField.php".

And @HLeithner 's comment above suggest a different solution.

avatar HLeithner
HLeithner - comment - 12 Sep 2023

as said own field instead of additonal attribute please. I'm closing this but can be reopend when we get it's own field or a more flexible way to change the label of the options (maybe swapable language constants)

avatar HLeithner HLeithner - close - 12 Sep 2023
avatar HLeithner HLeithner - change - 12 Sep 2023
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2023-09-12 11:19:00
Closed_By HLeithner
Labels Added: Feature Conflicting Files ? PR-5.0-dev
Removed: ? ?

Add a Comment

Login with GitHub to post a comment