User tests: Successful: Unsuccessful:
Pull Request for New Feature.
previous discussion of several approaches that led to this solution:
This RFC proposes to extend the configuration of com_fields to better control the displaying of Fields on (component edit / create) Forms. This functionality will greatly extend the use cases for com_fields (and therefore for Joomla!) in ‘real-life’ implementations.
In this PR, #19884 is 'cherry picked' (currently in staging) as this is a required bug fix for com_fields.
This RFC proposes to extend the configuration of com_fields to better control the displaying of Fields on (component edit / create) Forms. This functionality will greatly extend the use cases for com_fields in ‘real-life’ implementations.
I run a large blog site where the blogs are ‘enriched’ with custom fields to add credits, opengraph image / title / description, twitter card image / title / description to the blogs. The access to these field values must be set to public in order for visitors / facebook / twitter etc. to ‘see’ the given values.
These filling of these fields must be limited to the publisher role to avoid mis usage and to comply to site standards (for images).
The fields should be invisible to authors in order to avoid ‘support calls’: what are these fields for, why can't I edit them, etc.
With the current configuration settings this is not possible:
I run a membership site where users subscribe to a service. Depending on their subscription, values can be set in their user profile via com_fields. The amount of fields for all subscriptions total up to 50 fields.
The values set in these fields should be visible on the front-end (via a special view that reads the user’s set value (via com_fields api)), the access to these fields must be set to public in order for public and guests to see the values for a specific user.
Specific fields should only be visible when the user can edit (has Edit Custom Field Value' permission set to aloowed)
Furthermore: because the fields access is set to public, when a new user registers on the site, all (!) 50 fields are shown in the registration form as read-only, where the registering user needs to scroll down past all the read-only fields to reach the actual register button. Only the fields that are necessary in the form should be displayed.
The current limitation lies in the fact that the access field is used for both the form AND for the values.
I propose to extend com_fields with an additional parameter: 'Display when read-only'
The 'Display when read-only' setting toggles whether to display the field on the form when the field is read-only or not.
The 'Display when read-only' setting can be set on field level AND on group level, making the maintenance of large field sets easier as not every field needs to be modified when the 'Display when read-only' setting value changes (can be set on fields group level).
Setting the value on field level has authority over the setting in the fields group!
With the proposed change, the following configuration can be set for the com_content fields:
Users that do not have sufficient Access rights to edit the fields will also not see these fields on the article edit / creation form. This will make the edit / create form very UX friendly as only relevant fields are displayed on the form!
With the proposed change, the following configuration can be set for the com_users fields:
The benefit here is that users that do not have sufficient Access rights to edit the fields will also not see these fields on their user profile edit form. This will make the edit form very UX friendly as only relevant fields are displayed on the form!
in italics described above
Fields are always displayed write or read-only
yes, com_fields gets new configuration field
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_fields Language & Strings |
I have tested this item
First part of testing went fine, read only did show the country on reg as read only and then all 3 field on edit user and they could be edited.
At second part I bumped into an issue when wanting to create an article for author in backend to be able to edit that in front. Article->New is broken with the patch
Labels |
Added:
?
?
|
Goodmorning all :)
At second part I bumped into an issue when wanting to create an article for author in backend to be able to edit that in front. Article->New is broken with the patch
@ot2sen fixed :)
@ggppdk also removed he administrator check, so now also it displays / hides fields on back-end as well (not sure what I was thinking here :)).
@laoneo can you advice?
group | field = display?
------------------------
yes | yes = yes
no | yes = no
yes | no = no
no | no = no
yes | inverse = no
no | inverse = yes
Just refactored code to have generic helper function displayFieldOnForm that handles both the show_on parameter and the display_readonly parameter.
Just refactored code to have generic helper function displayFieldOnForm ...
Now looks like a much cleaner implementation
Added 'Inherit' value in field. So now you can select yes / no / inherit. Inherit is the default value.
Inherit takes the value from the field's group (and if no group the defaults to 'yes')
this way the value set in the field always has the authority over the value set in the group parameter.
thanks @laoneo :)
Now one more question left: should the show_on parameter also have a group setting or do we leave that as is (only field setting)?
If you consider to add a group setting for show_on, then please do it in a new pr.
f you consider to add a group setting for show_on, then please do it in a new pr.
I will not use that setting myself (the display_readonly does it all for me), was just thinking in terms of consistency with this PR.
Let's wait and see how the testing and feedback on this PR rolls, if asked for then we can decide to do it (in separate PR)
I have tested this item
Works fine now. Well done :)
I have tested this item
Works fine now. Well done :)
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-04-07 14:32:25 |
Closed_By | ⇒ | mbabker | |
Labels |
Added:
?
|
This is for me the approach which brings in less confusion. +1 from me.