/**
  * Chosen
  *
  * @param string $fieldName
  * @param array  $options
  * @return string
  */
 public function chosen($fieldName, $options = [])
 {
     $defaults = ['div' => ['class' => 'form-group'], 'class' => 'form-control form-control-chosen', 'empty' => true];
     if (isset($options['class'])) {
         $defaults = parent::addClass($defaults, $options['class']);
         unset($options['class']);
     }
     $options = array_merge($defaults, $options);
     return parent::input($fieldName, $options);
 }
Exemplo n.º 2
0
 /**
  * Adds the given class to the element options.
  *
  * Do not add a "form-error" class, though.
  *
  * @overwrite
  * @param array $options Array options/attributes to add a class to
  * @param string $class The classname being added.
  * @param string $key the key to use for class.
  * @return array Array of options with $key set.
  */
 public function addClass($options = array(), $class = null, $key = 'class')
 {
     if ($key === 'class' && $class === 'form-error') {
         return $options;
     }
     return parent::addClass($options, $class, $key);
 }