[com_fields] Store fields in 'com_fields' property instead of reusing 'params'#13353
[com_fields] Store fields in 'com_fields' property instead of reusing 'params'#13353rdeutz merged 2 commits intojoomla:stagingfrom
Conversation
|
I have tested this item ✅ successfully on c8ff6d1 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13353. |
Of course! Adjusted the PR description now 😄 |
|
I don't se the benefit for this change honestly? Params is made for custom fields, so why not reuse it? |
Because it's not made for custom fields. It's a groupd specified in many (if not most) extensions XML file to hold various item options. |
| // Load the item params from the request | ||
| // Load the fields data from the request | ||
| $data = JFactory::getApplication()->input->post->get('jform', array(), 'array'); | ||
|
|
There was a problem hiding this comment.
Fetching the data from the post request was only done for some exception I can't remember actually. IMO the custom fields values should be fetched from the item which get saved and not from the post request. That looks for me wrong.
There was a problem hiding this comment.
I haven't changed that specific line, only the comment tied to it.
May it be that the custom fields data has been sanitised and removed prior to that step and thus we need to fetch it again? I haven't looked closer at it when I did this PR.
There was a problem hiding this comment.
In most cases, the fields values are in $item->params which are validated by the form. The code is on line 68.
There was a problem hiding this comment.
I had a look now, the line is needed.
The thing is that $item is a JTable object and thus only contains the data that is going to be stored into the respective database table. There is neither a params or com_fields property at this point. So we need to fetch the raw form data and take the custom fields out of it.
There was a problem hiding this comment.
For contacts the $item->params property exists which holds the custom fields values. But you are right for articles not. What is missing here is the form validation when take it directly from the input.
There was a problem hiding this comment.
True that. I'd say it's out of scope of this PR as this behavior exists with or without this PR.
|
This PR is needed
thus avoid the extra step to find the custom fields inside the 'params' and then clean-up the 'params' array before DB save
|
c8ff6d1 to
77c0799
Compare
|
We have conflicts here. |
77c0799 to
66873f8
Compare
|
Rebased and conflict solved. |
66873f8 to
9ef4ae5
Compare
|
Rebased and fixed conflicts (again) |
Show custom fields in frontend article edit using the joomla.edit.params JLayout. Adjusted the JLayout to take a custom tab name.
9ef4ae5 to
75444ec
Compare
|
Rebased and fixed conflicts once more |
| * @return boolean | ||
| * | ||
| * @since 3.7.0 | ||
| */ |
There was a problem hiding this comment.
Please don't delete that code. It cleans up the items which do have a params attribute. Otherwise the value of the fields are saved in the params array of the item as well.
There was a problem hiding this comment.
The whole point of this PR is to not store the field data in the params property. So no, they aren't saved there since we don't populate it into params anymore. And thus that code isn't needed anymore. 😄
| JHtml::_('formbehavior.chosen', '#jform_catid', null, array('disable_search_threshold' => 0)); | ||
| JHtml::_('formbehavior.chosen', 'select'); | ||
| $this->tab_name = 'com-content-form'; | ||
| $this->ignore_fieldsets = array('image-intro', 'image-full', 'jmetadata', 'item_associations'); |
There was a problem hiding this comment.
Maybe a stupid question but why did you add this line? :-)
There was a problem hiding this comment.
Because the article form currently only renders a fixed set of fieldsets. But we need it to render all available fieldsets.
So I have changed it to it renders all except those which are already hardcoded rendered.
|
Please tag me if ready to test :) This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13353. |
|
@coolcat-creations It is ready for quite some time already 😄 |
|
I will test too during weekend |
|
I have tested this item ✅ successfully on 2b5784c This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13353. |
|
I will also have a look over the weekend, somehow I have the feeling something is missing. |
|
I have tested this item ✅ successfully on 2b5784c This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13353. |
|
RTC as there are 2 successfully Tests? |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13353. |
This decouples a part of #13182 since we don't seem to get an agreement there anytime soon 😄
Summary of Changes
Testing Instructions
jform_params_aliastojform_com_fields_aliasand the name fromjform[params][alias]tojform[com_fields][alias].Documentation Changes Required
None