本文整理汇总了PHP中Zend_Form_Element::getAttribs方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element::getAttribs方法的具体用法?PHP Zend_Form_Element::getAttribs怎么用?PHP Zend_Form_Element::getAttribs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element
的用法示例。
在下文中一共展示了Zend_Form_Element::getAttribs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: aElement
/**
* Render element
*
* @param Zend_Form_Element $element
* @return string
*/
public function aElement(Zend_Form_Element $element)
{
$viewClasses = array($element->getAttrib('class'));
if ($element->isRequired()) {
if (!$element->getAttrib('title')) {
$element->setAttrib('title', 'Field is required');
}
$viewClasses[] = 'aForm-field-required';
}
if ($element->getValidators()) {
$viewClasses[] = 'aForm-field-validate';
}
if ($element->hasErrors()) {
$viewClasses[] = 'aForm-field-invalid';
} elseif ($element->getValue() || !$element->isRequired()) {
$viewClasses[] = 'aForm-field-valid';
}
if ($element->getValidators()) {
$viewClasses[] = 'aForm-field-validate';
}
$element->setAttrib('class', implode(' ', $viewClasses));
$options = null;
$separator = null;
if ($element instanceof Zend_Form_Element_Multi) {
$options = $element->getMultiOptions();
$separator = $element->getSeparator();
}
return $this->view->{$element->helper}($element->getName(), $element->getValue(), $element->getAttribs(), $options, $separator);
}
示例2: getInputHTML
/**
* Gets form element html
*
* @param Zend_Form_Element $element
* @return string
*/
protected function getInputHTML($element)
{
$helper = $element->helper;
$elBelongsTo = $element->getBelongsTo();
if (!empty($this->belongsTo)) {
$name = $this->mergeBelongsTo($this->belongsTo, $element->getBelongsTo());
$name .= '[' . $element->getName() . ']';
} else {
if (!empty($elBelongsTo)) {
$name = $this->mergeBelongsTo($elBelongsTo, $element->getName());
} else {
$name = $element->getName();
}
}
$value = $element->getValue();
//echo 'Name:'.$name.' | Class:'. get_class($element).' | Helper:'.$helper.'['.$value.']'.'<br/>';
return $element->getView()->{$helper}($name, $value, $element->getAttribs(), $element->options);
}