Created
July 9, 2013 15:29
-
-
Save stefanotorresi/5958307 to your computer and use it in GitHub Desktop.
custom input filter services
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Zend\Filter\FilterChain; | |
use Zend\ServiceManager\FactoryInterface; | |
use Zend\ServiceManager\ServiceLocatorInterface; | |
class FormFactory implements FactoryInterface | |
{ | |
public function createService(ServiceLocatorInterface $serviceLocator) | |
{ | |
$form = new Form(); | |
// injecting the filtermanager is needed to use custom filter services | |
$chain = new FilterChain(); | |
$chain->setPluginManager($serviceLocator->get('FilterManager')); | |
$form->getFormFactory()->getInputFilterFactory()->setDefaultFilterChain($chain); | |
return $form; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
'type' => 'myfilter' | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
'filters' => array( | |
'invokables' => array( | |
'myfilter' => 'My\Fancy\Filter', | |
), | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment