gpt4 book ai didi

php - 从 Zend_Form_Element_File 移除格式

转载 作者:搜寻专家 更新时间:2023-10-31 20:56:27 25 4
gpt4 key购买 nike

我正在尝试从文件元素周围移除 dt 和 dd 装饰器。

通常我将 $element->setDecorators(array(array('ViewHelper'))); 应用于表单元素。
然而,这不适用于 Zend_Form_Element_File 的情况,因为会输出错误。

如有任何建议,我们将不胜感激

谢谢

最佳答案

您首先需要从表单中删除 DtDdWrapper 装饰器。其次,从每个元素中获取 Label 装饰器,并将标签属性设置为 null,最后,对于每个元素,删除 HtmlTag 装饰器。

阿拉:

<?php
class My_Form extends Zend_Form
{
public function init()
{
//Add elements first.

$this->removeDecorator('HtmlTag');
foreach ($this->getElements() as $element) {
$element->getDecorator('Label')->setTag(null);
$element->removeDecorator('HtmlTag');
$element->removeDecorator('DtDdWrapper');
}
}

}

这将使文件元素的重要文件元素装饰器完好无损,同时从所有元素中剥离其他装饰器。

关于php - 从 Zend_Form_Element_File 移除格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1205714/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com