Example #1
0
 /**
  * Renders the input.
  *
  * @param string $name name of the input
  * @param array $options the input options
  * @return string
  */
 public function renderInput($name, $options)
 {
     $options = Arrayhelper::merge($this->options, $options);
     $method = 'render' . Inflector::camelize($this->type);
     $value = $this->prepareValue();
     if (isset($options['items'])) {
         $options['items'] = $this->prepareItems($options['items']);
     }
     if (method_exists($this, $method)) {
         $input = call_user_func_array([$this, $method], [$name, $value, $options]);
     } else {
         $input = $this->renderDefault($name, $value, $options);
     }
     return $input;
 }