Exemplo n.º 1
0
 /**
  * render_field hook
  * @param  cs_form $form form object
  * @return string        the element html
  */
 public function render_field(cs_form $form)
 {
     $id = $this->get_html_id();
     $output = '';
     $form->set_attribute('enctype', 'multipart/form-data');
     if (!isset($this->attributes['class'])) {
         $this->attributes['class'] = '';
     }
     if ($this->has_errors()) {
         $this->attributes['class'] .= ' has-errors';
     }
     if ($this->disabled == TRUE) {
         $this->attributes['disabled'] = 'disabled';
     }
     $attributes = $this->get_attributes(array('type', 'name', 'id', 'size'));
     $output .= "<input type=\"hidden\" name=\"{$this->name}\" value=\"{$this->name}\" />";
     $output .= "<input type=\"file\" id=\"{$id}\" name=\"{$this->name}\" size=\"{$this->size}\"{$attributes} />";
     return $output;
 }