表单元素装饰器Zend Framework

时间:2013-04-10 10:22:42

标签: zend-framework twitter-bootstrap zend-form zend-form-element

我正在使用Zend Framework 1和this库来集成Twitter-bootstrap。这是一个很棒的库,但是我想为它添加新的装饰器(对于Zend表单元素文件),它看起来像here

所以而不是

<input id="image" type="file" name="image">

我想渲染类似的东西(包含所有样式和javascript)

<span class="btn btn-success fileinput-button">
  <i class="icon-plus icon-white"></i>
  <span>Add files...</span>
  <input type="file" multiple="" name="files[]">
</span>

我是Zend Framework的新手,不知道该怎么做。

问题是,我在库/ Twitter / Form.php,public / css和public / javascript中放了什么才能使它工作?

或者我可能要做别的事情?

我尝试在Form.php中添加装饰器,但没有应用装饰器(我不记得我做了什么)

所以主要的问题是,如何在库/ Twitter中为我的Element添加这个装饰器?

编辑:

我正在解决这个问题并设法使用jQuery-file-upload-ui.css(不记得文件名)显示带有“加”图片的绿色按钮,并在Form.php中更改$ decorators代码

if($element instanceof Zend_Form_Element_File)

位于

$decorators = array(
            "ViewHelper",
            array("Errors", array("placement" => "append")),
            array("Description", array("tag" => "span", "class" => "help-block")),
            array(array("ivanov2" => "HtmlTag"), array("tag" => "i", "class" => "icon-plus icon-white",'openOnly' => true,)),
            array(array('close' => 'HtmlTag'), array('tag' => 'i', 'closeOnly' => true)),
            array(array("ivanov" => "HtmlTag"), array("tag" => "span", "class" => "btn btn-success fileinput-button")),
            array(array("innerwrapper" => "HtmlTag"), array("tag" => "div", "class" => "controls")),
            array("Label", array("class" => "control-label")),
            array(array("outerwrapper" => "HtmlTag"), array("tag" => "div", "class" => "control-group"))
        );

但我仍然不知道如何放置包含某些内容的元素(例如文本):

<span>Add Files..</span>

我也想使用拖放,但不知道如何。

0 个答案:

没有答案
相关问题