Modified:
branches/FreeForm/Solar/View/Helper/FormElement.php
Log:
[FIX] Giving a step back and just extracting data from Solar_Form_Element
when it is passed. All the rest is like the original helper.
Modified: branches/FreeForm/Solar/View/Helper/FormElement.php
==============================================================================
--- branches/FreeForm/Solar/View/Helper/FormElement.php (original)
+++ branches/FreeForm/Solar/View/Helper/FormElement.php Fri Oct 3 12:29:42
2008
@@ -143,21 +143,33 @@
*
* Prepares an info array and imports to the properties.
*
- * @param array|Solar_Form_Element $spec An element object or an array
of
+ * @param array|Solar_Form_Element $info An element object or an array
of
* element information.
*
* @return void
*
*/
- protected function _prepare($spec)
+ protected function _prepare($info)
{
- if (! $spec instanceof Solar_Form_Element) {
- $spec = Solar::factory('Solar_Form_Element')->load($spec);
+ if ($info instanceof Solar_Form_Element) {
+ $info = $info->toArray();
}
+ $info = array_merge($this->_info, $info);
+
+ settype($info['type'], 'string');
+ settype($info['name'], 'string');
+ settype($info['label'], 'string');
+ settype($info['attribs'], 'array');
+ settype($info['options'], 'array');
+ settype($info['require'], 'bool');
+ settype($info['disable'], 'bool');
+ settype($info['invalid'], 'array');
+
foreach ($this->_keys as $key) {
+ unset($info['attribs'][$key]);
$prop = "_$key";
- $this->$prop = $spec[$key];
+ $this->$prop = $info[$key];
}
}
}