public function select($name, $list = array(), $selected = null, $options = array())
 {
     if (strpos(@$options['class'], 'form-control') === false) {
         @($options['class'] .= ' form-control');
     }
     return parent::select($name, $list, $selected, $options);
 }
 /**
  * Create a select box field.
  *
  * @param  string  $name
  * @param  array   $list
  * @param  string  $selected
  * @param  array   $options
  * @return string
  */
 public function select($name, $list = array(), $selected = null, $options = array(), $label = '')
 {
     if (!self::$is_bootstrap) {
         return parent::select($name, $list, $selected, $options);
     }
     $label_text = $label == '' ? $this->transformKey($name) : $label;
     $options = $this->appendClassToOptions('form-control', $options);
     // Call the parent select method so that Laravel can handle
     // the rest of the select set up.
     return $this->openGroup($name, $label_text) . parent::select($name, $list, $selected, $options) . $this->closeGroup($name);
 }
Exemplo n.º 3
0
 public function select($name, $list = [], $selected = null, $options = [])
 {
     $label = array_get($options, 'label', $this->translationDomain ? $this->translationDomain . '.' . $name : $name);
     unset($options['label']);
     $label = \Lang::get($label);
     $options = $this->getFieldOptions($options);
     $wrapperOptions = ['class' => $this->getRightColumnClass()];
     $inputElement = $this->form->select($name, $list, $selected, $options);
     $groupElement = '<div ' . $this->html->attributes($wrapperOptions) . '>' . $inputElement . $this->getFieldError($name) . '</div>';
     return $this->getFormGroup($name, $label, $groupElement);
 }
Exemplo n.º 4
0
 /**
  * Generate a select field.
  *
  * @param        $name
  * @param string $value
  * @param array  $options
  *
  * @return string
  */
 public function select($name, $value = null, $options = [])
 {
     $select_options = [];
     // Loop through, and pluck out the select box list options
     // from the $options array, then remove the select options.
     foreach ($options as $key => $label) {
         if (is_array($label)) {
             $select_options = $label;
             unset($options[$key]);
         }
     }
     return $this->formBuilder->select($name, $select_options, $value, $options);
 }
Exemplo n.º 5
0
 /**
  * Create a form select field.
  *
  * @param string                         $name
  * @param string                         $label
  * @param array                          $list
  * @param string                         $selected
  * @param \Illuminate\Support\MessageBag $errors
  * @param array                          $options
  *
  * @return string
  */
 protected function options($name, $label = null, array $list = array(), $selected = null, $errors = null, array $options = array())
 {
     $options = array_merge(array('class' => 'form-control'), $options);
     $return = $this->group($name, $errors);
     $return .= $this->label($name, $label);
     if ($this->formType == self::FORM_HORIZONTAL) {
         $return .= $this->group('', null, $this->inputClass);
     }
     $return .= $this->form->select($name, $list, $selected, $options) . "\n";
     $return .= $this->errors($name, $errors);
     if ($this->formType == self::FORM_HORIZONTAL) {
         $return .= '</div>' . "\n";
     }
     $return .= '</div>' . "\n";
     return $return;
 }
Exemplo n.º 6
0
 /**
  * Create a form select field.
  *
  * @param string                         $name
  * @param string                         $label
  * @param array                          $list
  * @param string                         $selected
  * @param \Illuminate\Support\MessageBag $errors
  * @param array                          $options
  *
  * @return string
  */
 protected function options($name, $label = null, array $list = array(), $selected = null, $errors = null, array $options = array())
 {
     $return = '';
     $options = array_merge(array('class' => 'form-control', 'id' => $name), $options);
     $containerAttributes = $this->getContainerAttributes($options);
     $labelAttributes = $this->getLabelAttributes($options);
     if (!isset($containerAttributes['display'])) {
         $return .= $this->group($name, $errors, 'form-group', $containerAttributes);
     }
     $return .= $this->label($name, $label, $labelAttributes);
     if ($this->formType == self::FORM_HORIZONTAL) {
         $return .= $this->group('', null, $this->inputClass);
     }
     $return .= $this->form->select($name, $list, $selected, $options) . "\n";
     $return .= $this->errors($name, $errors);
     if ($this->formType == self::FORM_HORIZONTAL) {
         $return .= '</div>' . "\n";
     }
     if (!isset($containerAttributes['display'])) {
         $return .= '</div>' . "\n";
     }
     return $return;
 }
Exemplo n.º 7
0
 /**
  * @param Field $field
  * @return string
  */
 public function selectField(Field $field)
 {
     return $this->builder->select($field->name, $field->options ?: [], $field->value, $field->getAttributes());
 }
Exemplo n.º 8
0
 /**
  * Create a select box field with empty option support.
  * @param  string  $name
  * @param  array   $list
  * @param  string  $selected
  * @param  array   $options
  * @return string
  */
 public function select($name, $list = [], $selected = null, $options = [])
 {
     if (array_key_exists('emptyOption', $options)) {
         $list = ['' => $options['emptyOption']] + $list;
     }
     return parent::select($name, $list, $selected, $options);
 }
Exemplo n.º 9
0
 /**
  * Create a select box field.
  *
  * @param  string  $name
  * @param  array   $list
  * @param  string  $selected
  * @param  array   $options
  *
  * @return string
  */
 public function select($name, $list = array(), $selected = null, $options = [])
 {
     $this->addErrorClass($name, $options);
     $tags['input'] = parent::select($name, $list, $selected, $options);
     $tags['error'] = $this->getErrorTag($name);
     return $this->buildTags($tags);
 }
Exemplo n.º 10
0
 public function select($name, $list = [], $selected = null, $options = [])
 {
     $options = array_merge($options, $this->parsley->getFieldRules($name));
     return parent::select($name, $list, $selected, $options);
 }
Exemplo n.º 11
0
 /**
  * {@inheritdoc}
  * @param string $name
  * @param array  $list
  * @param null   $selected
  * @param array  $attributes
  * @return string
  */
 public function select($name, $list = array(), $selected = null, $attributes = array())
 {
     $attributes['class'] = isset($attributes['class']) ? self::FORM_CONTROL . ' ' . $attributes['class'] : self::FORM_CONTROL;
     return parent::select($name, $list, $selected, $attributes);
 }
 /**
  * Create a select box field.
  *
  * @param  string $name
  * @param  array  $list
  * @param  string $selected
  * @param  array  $options
  * @return string
  */
 public function select($name, $list = array(), $selected = null, $options = array())
 {
     $options = $this->addErrorClass($name, $options);
     $options = $this->checkRequired($name, $options);
     return parent::select($name, $list, $selected, $options);
 }
 /**
  * @see Illuminate\Html\FormBuilder
  */
 public function select($name, $list = [], $selected = null, $options = [])
 {
     $options = $this->laravelToJquery($name) + $options;
     return parent::select($name, $list, $selected, $options);
 }
Exemplo n.º 14
0
 /**
  * @see Illuminate\Html\FormBuilder
  */
 public function select($name, $list = [], $selected = null, $options = [])
 {
     $options = $this->converter->convert(Helper::getFormAttribute($name)) + $options;
     return parent::select($name, $list, $selected, $options);
 }
Exemplo n.º 15
0
 /**
  * Create a HTML select element.
  *
  * @param  string  $name
  * @param  string  $label
  * @param  array   $options
  * @param  string  $selected
  * @param  array   $attributes
  * @return string
  */
 public function select($name, $label = '', $options = null, $selected = null, $attributes = array())
 {
     $modelOptions = null;
     if (is_null($options)) {
         $modelOptions = $this->getModelOptions($name);
     }
     if (!is_null($modelOptions)) {
         $options = $modelOptions;
     }
     $selected = $this->calculateValue($name, $selected);
     $attributes = $this->setAttributes($name, $attributes);
     $field = parent::select($name, $options, $selected, $attributes);
     return $this->buildWrapper($field, $name, $label);
 }
Exemplo n.º 16
0
 /**
  * Create a plain select box field.
  *
  * @param  string $name
  * @param  array  $list
  * @param  string $selected
  * @param  array  $options
  *
  * @return string
  */
 public function plainSelect($name, $list = [], $selected = null, $options = [])
 {
     return parent::select($name, $list, $selected, $options);
 }
Exemplo n.º 17
0
 /**
  * Create a select box field.
  *
  * @param  string  $name
  * @param  array   $list
  * @param  string  $selected
  * @param  array   $options
  * @return \Illuminate\Support\HtmlString
  */
 public function select($name, $list = [], $selected = null, $options = [])
 {
     return new HtmlString(parent::select($name, $list, $selected, $options));
 }
Exemplo n.º 18
0
 /**
  * Create a select box field.
  *
  * @param  string  $name
  * @param  array   $list
  * @param  string  $selected
  * @param  array   $options
  * @return string
  */
 public function select($name, $list = array(), $selected = null, $options = array())
 {
     $this->appendReadOnly($options);
     return parent::select($name, $list, $selected, $options);
 }
Exemplo n.º 19
0
 /**
  * Create a select box field.
  *
  * @param string $name
  * @param array $list
  * @param string $selected
  * @param array $options
  * @return string 
  * @static 
  */
 public static function select($name, $list = array(), $selected = null, $options = array())
 {
     return \Illuminate\Html\FormBuilder::select($name, $list, $selected, $options);
 }
Exemplo n.º 20
0
 public function select($name, $list = array(), $selected = null, $options = array())
 {
     $defaults = array("class" => "form-control");
     $options = array_merge($defaults, $options);
     return parent::select($name, $list, $selected, $options);
 }