ZF2 documentation says following on defult services documentation;
InputFilterManager, mapping to Zend\\Mvc\\Service\\InputFilterManagerFactory. This
Ok, after spending 3 bloody hours (thanks to incredible(!) documentation) I figured it out. I'm writing my solution as an answer, hopefully it will help others who want to write their custom inputfilters.
module.config.php
by input_filters top key, not filter, filters, filter_manger, filtermanager etc..Zend\InputFilter\InputFilter
when writing your own GlassFilter
.init()
method of GlassFilter
, not in the __constructor()
. It will be called automatically after construction.inputfiltermanager
, not servicemanager
directly.Config example:
'input_filters' => array(
'invokables' => array(
'glassfilter' => '\Application\Filter\GlassFilter',
),
),
Usage example:
$glassfilter = $serviceLocator->get('InputFilterManager')->get('glassfilter');