예제 #1
0
 /**
  * @param $multiline boolean
  * @param $values    string[]
  * @return Element
  */
 protected function buildString($multiline = false, $values = null)
 {
     if ($multiline) {
         $input = new Textarea($this->getFieldName(), $this->value);
         $input->addClass('autowidth');
         $input->addClass('autoheight');
     } elseif ($values) {
         if (!isset($values[''])) {
             $values = array_merge(['' => ''], $values);
         }
         $input = new Select($this->getFieldName(), $values, $this->value);
     } else {
         $input = new Input($this->getFieldName(), $this->value);
         $input->setAttribute('autocomplete', 'off');
         $input->addClass('autowidth');
     }
     if ($this->readonly) {
         $input->setAttribute('readonly');
     }
     return $input;
 }