/** * Decorate element bofore render * @var string */ public function render() { $this->decorate(); // decorate bofore render return parent::render(); }
/** * Reload saveJson for checking body first */ public function saveJson() { if (!$this->body) { require_once 'Hush/Html/Form/Exception.php'; throw new Hush_Html_Form_Exception("please call Hush_Html_Form::buildForm method first"); } return parent::saveJson(); }
<?php require_once '../../../etc/frontend.config.php'; require_once 'Hush/Util.php'; require_once 'Hush/Html/Element.php'; $ele = new Hush_Html_Element('a', false); $ele->setBody('testLink')->setAttrs(array('id' => 'test', 'class' => 'test', 'href' => '#')); echo $ele->render(); echo "<br/><br/>\n"; require_once 'Hush/Html/Form.php'; $form = new Hush_Html_Form(); $form->setName('testForm')->setAction('testAction')->setAttrs(array('id' => 'test', 'class' => 'test', 'method' => 'post')); //echo $form->render(); //echo "<br/><br/>\n"; require_once 'Hush/Html/Form/Button.php'; $input = new Hush_Html_Form_Button(); $input->setName('testButton')->setValue('testButton')->setAttrs(array('id' => 'test', 'class' => 'test')); $input_str = $input->saveJson(); $input = $input->loadJson($input_str); $form->addElement($input); //echo $input->render(); //echo "<br/><br/>\n"; require_once 'Hush/Html/Form/Submit.php'; $input = new Hush_Html_Form_Submit(); $input->setName('testSubmit')->setValue('testSubmit')->setAttrs(array('id' => 'test', 'class' => 'test')); $input_str = $input->saveJson(); $input = $input->loadJson($input_str); $form->addElement($input); //echo $input->render(); //echo "<br/><br/>\n"; require_once 'Hush/Html/Form/Text.php';