ZF2, how to create form view helper?

前端 未结 1 452
执念已碎
执念已碎 2021-01-22 11:41

I want to change the way ZF2 shows the form elements. I think I have to create my own view helper but I don\'t know how. I Googled for it but didn\'t find any useful resource.

相关标签:
1条回答
  • 2021-01-22 12:17

    See the SourceCode of existing Zend\Form\View\Helper*

    Basically you extend those and overwrite the required functions of stuff you want to modify.

    After that you'll need to register your very own view helper. This is easily done within Module.php's getViewHelperConfig()

    public function getViewHelperConfig() 
    {
        return array(
            'invokables' => array(
                'customViewHelperCallName' => 'Namespace\Form\View\Helper\Classname'
            )
        );
    }
    
    0 讨论(0)
提交回复
热议问题