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
Added a getSaveData function in form controller for data src override #15331
Conversation
I have tested this item ✅ successfully on f16ab9d This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15331. |
1 similar comment
I have tested this item ✅ successfully on f16ab9d This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15331. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15331. |
3rd party developer using this function name already may have a b/c break, also reading the code correctly this could be done in the jmodel->validate function, actually I think it's the correct place. |
I don't think so, it's the controller role to get the data from input, not the model's. |
There is another way to modify the data with a event, I'm not sure if we really need 3 ways to do the same thing. |
@HLeithner What shall we do with this PR? Remove RTC? Set any other label? |
you have to be more explicit about what your solution is @HLeithner |
Beside the inconsistency in this PR ( Which maybe makes for sense to split this 300 lines function into more logical parts to get better readability and reusability. I'm closing this for now, thx for your engagement. |
that was the point that it's a shame to have to override the whole controller save function for just the input... but ok, whatever. |
@julienV You could try doing this against 4.0. More chances to get it in there... |
Summary of Changes
This is a very simple change to allow for form controller subclasses to easily override the source of data.
Currently, you have to rewrite the full save function if you want to add data other than jform post data.
For example for file uploads, a commonly found workaround, is to use the prepareTable function of the model, but i think it would be much cleaner to pull the data from controller, and not the model.
Testing Instructions
It shouldn't change anything as long as there is no override, so testing is just saving any form using the regular form controller (e.g: an article)
Expected result
works as usual
Actual result
works...
Documentation Changes Required
Changes nothing for end user