如何将自定义样式附加到zf2表单中 [英] How to attach custom styles into zf2 forms

查看:86
本文介绍了如何将自定义样式附加到zf2表单中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许是明显的问题,但是您能告诉我如何在zend Framework 2中由标准视图助手创建的表单中添加自定义CSS样式吗?

Maybe its obvious problem but could you please tell me how can I add custom css styles to forms created by standard view helpers in zend framework 2?

我正在尝试将某些样式附加到ZfcUser创建的表单上

Im trying to attach some styles to forms created by ZfcUser

推荐答案

分配课程属性:)

    $this->add(array(
        'name' => 'element_name',
        'options' => array(
            'label' => 'element_label'
        ),
        'attributes' => array(
            'type' => 'element_type',
            'class'  => 'testing'
        )
    ));

由于要扩展现有表单,因此可以先获取表单,然后再单击$form->get('elementname')->setAttribute('class','blubb');,或者使用上面附带的所有样式的自定义表单覆盖ZfCUser的服务表单.

Since you want to extend an existing form, you could either grab the Form and then $form->get('elementname')->setAttribute('class','blubb'); or you overwrite the Service-Form from ZfCUser with your custom form that has all styles attached, given above example.

这篇关于如何将自定义样式附加到zf2表单中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆