No Code Attached Yet
avatar GeoTimber
GeoTimber
6 Jan 2020

Is your feature request related to a problem? Please describe.

I expected to find the custom callback filters to be included in the InputFilter class in the clean method but I can only find them in the Form class under the filterField method

Describe the solution you'd like

Move the callback filter check to InputFilter::clean method

Additional context

This would allow us to call

$myValue = JFactory::getApplication()->input->get( 'myvalue', false, 'myCustomFilter::filter');

in our controllers to get our custom filter working to return our value ,which is not possible at the moment.

avatar GeoTimber GeoTimber - open - 6 Jan 2020
avatar joomla-cms-bot joomla-cms-bot - change - 6 Jan 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 6 Jan 2020
avatar GeoTimber GeoTimber - change - 6 Jan 2020
Title
Why are the custom callback filters not executed in the InputFilter::clean methods?
Why are the custom callback filters not executed in the InputFilter::clean method?
avatar GeoTimber GeoTimber - edited - 6 Jan 2020
avatar Fedik
Fedik - comment - 6 Jan 2020

it works:

$myValue = myCustomFilter::filter($app->input->get( 'myvalue', false, 'raw'));
avatar GeoTimber
GeoTimber - comment - 6 Jan 2020

Fair enough but that is not the same, I have not knowledge about the 'default' value in my myCustomFilter::filter method and may destroy it in my filter.

It will work, I just can't see why it is not in the InputFilter class.

avatar mbabker
mbabker - comment - 6 Jan 2020

The InputFilter class by design does not support callbacks. Why a set of non-standard filters was introduced into the Form class to me makes no sense (in a couple of cases this implies that someone confused filtering logic with validation logic as at least the "TEL" case should be a validation rule and not a filtering rule (and strangely enough there does exist a "tel" validation rule ?‍♂)).

avatar joomdonation joomdonation - change - 12 Nov 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-11-12 09:55:13
Closed_By joomdonation
Labels Added: No Code Attached Yet
Removed: ?
avatar joomdonation joomdonation - close - 12 Nov 2022
avatar joomdonation
joomdonation - comment - 12 Nov 2022

As @mbabker pointed out, our InputFilter class does not support callbacks, so please use the workaround provided by @Fedik in earlier comment. There is nothing we can do here, so I'm closing this issue.

Add a Comment

Login with GitHub to post a comment