-1
我用htmlpurifier爲形式的過濾器。但是在遷移zf2-> zf3之後它不起作用。 「插件管理器Zend \ Filter \ FilterPluginManager」中找不到名爲「htmlpurifier」的插件。雖然在模塊配置htmlpurifier存在。HTMLPurifier不起作用
類PostFieldset延伸字段集實現InputFilterProviderInterface:
public function __construct(PostInterface $post, HydratorInterface $hydrator, $name = "post", $options = array())
parent::__construct($name, $options);
$this->setHydrator($hydrator);
$this->setObject($post);
...
$this->add(array(
'type' => 'textarea',
'name' => 'text',
'attributes'=>array(
'class' => 'form-control',
'required' => 'required',
'rows' => '3',
),
'options' => array(
'label' => 'The text'
)
));
公共函數getInputFilterSpecification():
return array(
'text' => array(
'required' => true,
'filters'=>array(
array(
'name' => 'htmlpurifier'
),
),
'validators' => array(
array(
'name'=>'StringLength',
'options'=>array(
'encoding'=>'UTF-8',
'min'=>1,
'max'=>250000,
)
)
)
),
模塊配置在zenddevelopertools:
'filters' =>
array (size=2)
'factories' =>
array (size=1)
'Soflomo\Purifier\PurifierFilter' => string 'Soflomo\Purifier\Factory\PurifierFilterFactory' (length=46)
'aliases' =>
array (size=1)
'htmlpurifier' => string 'Soflomo\Purifier\PurifierFilter' (length=31)
https://bitbucket.org/mad-max/blog-note3