/** * フォームを登録する * @access public * @param String $formName フォーム名 * @param Object $form フォームオブジェクト */ public function setForm($formName = '', $form = null) { /* 初期値をセットする */ if (empty($form)) { $form =& $this->request->getAttribute($formName); if (empty($form)) { throw new ApplicationException('Not found form is "' . $formName . '."'); } } /* エラー項目の背景色を設定する */ if ($this->request->hasErrors()) { $errorNames =& $this->request->getErrorNames(); $errorNames = array_unique($errorNames); foreach ($errorNames as $name) { if ($form->elementExists($name)) { $element =& $form->getElement($name); $this->_setErrorAttribute($element); } } } /* フォームをsmartyにセットする */ $form->accept($this->quickformSmarty); $this->setAttribute($formName, $this->quickformSmarty->toArray()); }