public function render(&$upload, $errors = array()) { // Load base template and attributes $result = parent::render($render_variables, $errors); $result['template']->element = form::textarea($result['attributes'], $this->value); // Return the resulting output return (string) $result['template']->render(); }
public function render(&$render_variables, $errors = array()) { $result = parent::render($render_variables, $errors); // If $force_selection is TRUE, add 'Please select...' as first item if ($this->force_selection) { $this->options = array('_NO_SELECTION_' => ucfirst(Kohana::lang('morf.pleaseselect'))) + $this->options; } return $result; }
public function render(&$render_variables, $errors = array()) { $result = parent::render($render_variables, $errors); // Clean attributes $id = $this->_clean_attributes($result['attributes'], 'id'); $buffer = $this->_create_rating($result['attributes']); $result['template']->element = $buffer; $result['template']->attributes = form::attributes($result['attributes']); return (string) $result['template']->render(); }
public function render(&$render_variables, $errors = array()) { // Load base template and attributes $result = parent::render($render_variables, $errors); if (is_array($result) and $result['type'] == 'submit') { $render_variables['submit'] = TRUE; } $result['template']->element = form::button($result['attributes'], $this->value); // Return the resulting output return (string) $result['template']->render(); }
public function render(&$render_variables, $errors = array()) { // Load base template and attributes $result = parent::render($render_variables, $errors); $result['template']->element = $this->value; $result['attributes'] = $this->_filter_attributes(array('name'), $result['attributes']); if ($result['attributes']) { $result['template']->attributes = form::attributes($result['attributes']); } // Return the resulting output return (string) $result['template']->render(); }
public function render(&$render_variables, $errors = array()) { // Load base template and attributes $result = parent::render($render_variables, $errors); // Discover the type switch ($this->type) { case 'input': $result['template']->element = form::input($result['attributes'], $this->value); break; case 'password': $result['template']->element = form::password($result['attributes'], $this->value); break; case 'submit': $result['template']->element = form::submit($result['attributes'], $this->value); $render_variables['submit'] = TRUE; break; case 'radio': $result['template']->element = form::radio($result['attributes'], $this->value); break; case 'checkbox': $result['attributes']['value'] = $this->value; if ($this->value = Input::instance()->post($this->name)) { $result['template']->element = form::checkbox($result['attributes'], $this->value, TRUE); } else { $result['template']->element = form::checkbox($result['attributes'], $this->value); } break; case 'hidden': $result['template']->element = form::hidden($this->name, $this->value); break; case 'file': $result['template']->element = form::upload($result['attributes'], $this->value); $render_variables['enctype'] = 'multipart/form-data'; break; } // Return the resulting output return (string) $result['template']->render(); }
/** * Renders the Morf object into an HTML form * * @param boolean $print If TRUE render will automatically print the form * @return string HTML form representation of the Morf object * @author Sam Clark */ public function render($print = FALSE) { // Load correct view $view = new View('morf/groups/form'); $element_cache = ''; $render_variables = array('enctype' => 'application/x-www-form-urlencoded', 'submit' => FALSE); // Foreach element foreach ($this->elements as $name => $element) { $element_cache .= $element->render($render_variables, $this->errors); } $this->enctype = $render_variables['enctype']; if (!$render_variables['submit'] and $this->config['autosubmit']) { $element_cache .= Morf_Element::factory('input', $this->config['autosubmit']['config'], $this->config['autosubmit']['value'])->render($render_variables, $this->errors); } // Create output buffer $result = form::open($this->action, $this->_format_attributes()); // Apply the rendered elements to the view $view->elements = $element_cache; // Render the resulting view $result .= $view->render(); // Close form $result .= form::close(); // If print is true, print the output if ($print) { echo $result; } // Return the resulting output return $result; }