'Zend\InputFilter\InputFilter', 'collection' => 'Zend\InputFilter\CollectionInputFilter', ); /** * Whether or not to share by default * * @var bool */ protected $shareByDefault = false; /** * @param ConfigInterface $configuration */ public function __construct(ConfigInterface $configuration = null) { parent::__construct($configuration); $this->addInitializer(array($this, 'populateFactory')); } /** * Inject this and populate the factory with filter chain and validator chain * * @param $inputfilter */ public function populateFactory($inputfilter) { if ($inputfilter instanceof InputFilter) { $factory = $inputfilter->getFactory(); $factory->setInputFilterManager($this); if ($this->serviceLocator instanceof ServiceLocatorInterface) { $factory->getDefaultFilterChain()->setPluginManager($this->serviceLocator->get('FilterManager')); $factory->getDefaultValidatorChain()->setPluginManager($this->serviceLocator->get('ValidatorManager')); } } } /** * {@inheritDoc} */ public function validatePlugin($plugin) { if ($plugin instanceof InputFilterInterface) { // Hook to perform various initialization, when the inputfilter is not created through the factory if ($plugin instanceof InitializableInterface) { $plugin->init(); } // we're okay return; } throw new Exception\RuntimeException(sprintf( 'Plugin of type %s is invalid; must implement Zend\InputFilter\InputFilterInterface', (is_object($plugin) ? get_class($plugin) : gettype($plugin)) )); } }