Renders the value of an element wrapped in a span with a 'value-node' class name to identify it in a content element dijit.
More...
List of all members.
Detailed Description
Renders the value of an element wrapped in a span with a 'value-node' class name to identify it in a content element dijit.
- Copyright:
- 2011-2012 Perforce Software. All rights reserved
- License:
- Please see LICENSE.txt in top-level folder of this distribution.
- Version:
- 2012.2/486814
Member Function Documentation
Content_Form_Decorator_Value::_renderArray |
( |
array $ |
value | ) |
[protected] |
Return the value of the element with array value for display wrapped in a span tag w.
a special class.
- Parameters:
-
array | $value | Array to render |
- Returns:
- string
{
$html = '';
foreach ($value as $key => $item) {
if ($this->_htmlArrayItemTag) {
$item = "<{$this->_htmlArrayItemTag}>$item</{$this->_htmlArrayItemTag}>";
}
$html .= $item;
}
if ($this->_htmlArrayTag) {
$html = "<{$this->_htmlArrayTag} class='" . $this->_htmlClassName
. "'>$html</{$this->_htmlArrayTag}>";
} else {
$html = "<div class='" . $this->_htmlClassName
. "'>" . $html . "</div>";
}
return $html;
}
Content_Form_Decorator_Value::render |
( |
$ |
content | ) |
|
Return the value of the element for display wrapped in a span tag w.
a special class.
- Parameters:
-
string | $content | The content to render. |
- Returns:
- string
{
$element = $this->getElement();
$value = $element->getValue();
$multiOptions = $element->options;
foreach ($this->_skipElements as $elementClass) {
if ($element instanceof $elementClass) {
return $content;
}
}
if (!empty($multiOptions)) {
if (is_array($value)) {
foreach ($value as $key => $item) {
$value[$key] = array_key_exists($item, $multiOptions)
? $multiOptions[$item]
: $item;
}
} else {
$value = array_key_exists($value, $multiOptions)
? $multiOptions[$value]
: $value;
}
}
if ($element->isArray() && is_array($value)) {
$value = $this->_renderArray($value);
} else {
$value = "<span class='" . $this->_htmlClassName
. "'>" . $value . "</span>";
}
switch ($this->getPlacement()) {
case self::APPEND:
return $content . $value;
case self::PREPEND:
return $value . $content;
default:
return $value;
}
}
Member Data Documentation
Content_Form_Decorator_Value::$_htmlArrayItemTag = 'li' [protected] |
Content_Form_Decorator_Value::$_htmlArrayTag = 'ul' [protected] |
Content_Form_Decorator_Value::$_htmlClassName = "value-node" [protected] |
Content_Form_Decorator_Value::$_skipElements [protected] |
Initial value: array (
'Zend_Form_Element_Captcha'
)
The documentation for this class was generated from the following file:
- application/content/forms/decorators/Value.php