|
Perforce Chronicle 2012.2/486814
API Documentation
|
Extended view helper for hidden form element to support rendering sequence of hidden elements in the case of element's value is an array. More...
Protected Member Functions | |
| _hidden ($name, $value=null, $attribs=null) | |
| Override parent to support for array of values. | |
Extended view helper for hidden form element to support rendering sequence of hidden elements in the case of element's value is an array.
| P4Cms_View_Helper_FormHidden::_hidden | ( | $ | name, |
| $ | value = null, |
||
| $ | attribs = null |
||
| ) | [protected] |
Override parent to support for array of values.
If $value is an array, then this method returns list of hidden elements where the name will have appended square brackets.
| string | $name | the element name |
| string | array | $value | optional - the element value or list of values |
| array | $attribs | optional - attributes for the element |
{
if (is_array($value)) {
// for array values, remove id from attributes as there
// would be multiple hidden elements with the same id
unset($attribs['id']);
// assemble list if hidden elements, one for each value
$elementsList = array();
foreach ($value as $singleValue) {
$elementsList[] = parent::_hidden($name . '[]', $singleValue, $attribs);
}
return implode("\n", $elementsList);
}
return parent::_hidden($name, $value, $attribs);
}