/** * * Automatically adds multiple pieces to the form. * * @param Solar_Form|array $spec If a Solar_Form object, adds * attributes, elements and feedback from the object properties. * If an array, treats it as a a collection of element info * arrays and adds them. * * @return Solar_View_Helper_Form * */ public function auto($spec) { if ($spec instanceof Solar_Form) { // add from a Solar_Form object. // set the form status. $this->setStatus($spec->getStatus()); // set the form attributes foreach ((array) $spec->attribs as $key => $val) { $this->setAttrib($key, $val); } // add form-level feedback $this->addFeedback($spec->feedback); // add elements foreach ((array) $spec->elements as $info) { $this->addElement($info); } } elseif (is_array($spec)) { // add from an array of elements. foreach ($spec as $info) { $this->addElement($info); } } // done return $this; }
/** * * Automatically adds attributes and feedback, and sets status, for the * form as a whole from a Solar_Form object. * * @param Solar_Form $form Add from this form object. * * @return Solar_View_Helper_Form * */ public function meta(Solar_Form $form) { // add from a Solar_Form object. // set the form status. $this->setStatus($form->getStatus()); // retain the automatic attribs separately from those // specified at the view level (i.e. in this object) $this->_attribs_auto = array_merge((array) $this->_attribs_auto, (array) $form->attribs); // add form-level feedback $this->addFeedback($form->feedback); // done return $this; }