_element, $name); } /** * * set force count multiple flag * * @param boolean $forceCountMultiple * * @return $this */ public function setForceCountMultiple($forceCountMultiple) { $this->_forceCountMultiple = (bool)$forceCountMultiple; return $this; } /** * * get force count multiple flag * * @return boolean */ public function getForceCountMultiple() { return $this->_forceCountMultiple; } /** * * renders the html form element * the method is run by all subclasses who don't have it overridden * if a post value is an array, we will render a multiple element * for serialized data, we change the brackets to ' rather than " * * @return string the html code of the element */ public function render() { $render = array(); $value = $this->getValue(); if (is_array($value)) { $this->setMultiple(true); } else { $value = array($value); } foreach ($value as $key => $val) { $forceCountMultiple = $this->getForceCountMultiple(); $multiple = ($this->getMultiple() === true) ? ((is_string($key) || $forceCountMultiple) ? '[' . $key . ']' : $this->_brackets) : ''; if (is_array($val)) { $element = new Hidden($this->_name . $multiple); $element->setForceCountMultiple($forceCountMultiple) ->setValue($val); $render[] = $element->render(); } else { $render[] = 'renderAttributes() . "value='" . $val . "' " . $this->_endTag; } } return implode(self::NL, $render); } }