-
-
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
[5.0] Add alternative field labels (+ a new attribute) for the Status field #35743
Conversation
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). |
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. |
c002bd2
to
df66317
Compare
df66317
to
a31472c
Compare
Adds alternative labels with JDISABLED/JENABLED for StatusField which can be used with the `alt_labels="true"` field attribute. These alternative labels make more sense in many contexts and effectively cover for custom fields used by many extensions when used in conjunction with the `optionsFilter` attribute.
Allows again the form to define additional options retaining the original behavior.
StatusField now extends PredefinedlistField again, reverting a potential B/C break. Refs: @bembelimen
Rebased to |
I have tested this item ✅ successfully on 255d840 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35743. |
This pull request has automatically rebased to 4.2-dev. |
This pull requests has been automatically converted to the PSR-12 coding standard. |
This pull request has been automatically rebased to 5.0-dev. |
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. |
could someone change the title to say [5.0] instead of 4.1 please |
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. |
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. |
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. |
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. |
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) |
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 thealt_labels
field attribute. This can be used in conjunction withoptionsFilter
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:
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.