How to use a custom form view helper in Zend Framework 2?

后端 未结 2 1721
天涯浪人
天涯浪人 2021-01-13 01:26

I wrote a form view helper, that extends the Zend\\Form\\View\\Helper\\FormMultiCheckbox and overwrites its renderOptions(...) method:



        
2条回答
  •  [愿得一人]
    2021-01-13 02:28

    Although Andrews answer works, it's not necessary, just use the default view helper name and map it to your helper class, the application will then use your helper instead

    public function getViewHelperConfig() {
        return array(
            'invokables' => array(
                'formmulticheckbox' => 'MyNamespace\Form\View\Helper\FormMultiCheckbox',
            ),                
        );
    }
    

提交回复
热议问题