From 60713cb5212ca0bce0ad074d0ae860ad4264ec90 Mon Sep 17 00:00:00 2001 From: Robert Lester Date: Wed, 11 Oct 2017 10:02:28 -0400 Subject: [PATCH 1/2] Create an interior wrapper for input-group when using prefix/suffix When using horizontal forms, you cannot add the input-group class to the same wrapping element that has the col-* classes. input-group removes passing of the column so the prefix/suffix column extends past the margins of the other fields in the form. --- src/BootstrapForm.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/BootstrapForm.php b/src/BootstrapForm.php index 9df2c95..0642634 100644 --- a/src/BootstrapForm.php +++ b/src/BootstrapForm.php @@ -625,9 +625,9 @@ public function input($type, $name, $label = null, $value = null, array $options $optionsField = $this->getFieldOptions(array_except($options, ['suffix', 'prefix']), $name); - if(isset($options['prefix']) || isset($options['suffix'])) { + /*if(isset($options['prefix']) || isset($options['suffix'])) { $this->config->set('bootstrap_form.right_column_class', $this->config->get('bootstrap_form.right_column_class'). ' input-group'); - } + }*/ $inputElement = ''; @@ -640,9 +640,13 @@ public function input($type, $name, $label = null, $value = null, array $options if(isset($options['suffix'])) { $inputElement .= $options['suffix']; } + + $inputElement = $inputElement . $this->getFieldError($name) . $this->getHelpText($name, $optionsField); + + if (isset($options['prefix']) || isset($options['suffix'])) $inputElement = '
' . $inputElement . '
'; $wrapperOptions = $this->isHorizontal() ? ['class' => $this->getRightColumnClass()] : []; - $wrapperElement = 'html->attributes($wrapperOptions) . '>' . $inputElement . $this->getFieldError($name) . $this->getHelpText($name, $optionsField) . ''; + $wrapperElement = 'html->attributes($wrapperOptions) . '>' . $inputElement . ''; return $this->getFormGroup($name, $label, $wrapperElement); } From 949163802dff12bd42c40990d3f35eabdde348b3 Mon Sep 17 00:00:00 2001 From: Robert Lester Date: Fri, 13 Oct 2017 09:42:52 -0400 Subject: [PATCH 2/2] Update BootstrapForm.php --- src/BootstrapForm.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapForm.php b/src/BootstrapForm.php index 0642634..1164885 100644 --- a/src/BootstrapForm.php +++ b/src/BootstrapForm.php @@ -641,12 +641,12 @@ public function input($type, $name, $label = null, $value = null, array $options $inputElement .= $options['suffix']; } - $inputElement = $inputElement . $this->getFieldError($name) . $this->getHelpText($name, $optionsField); + $inputElement = $inputElement . $this->getHelpText($name, $optionsField); if (isset($options['prefix']) || isset($options['suffix'])) $inputElement = '
' . $inputElement . '
'; $wrapperOptions = $this->isHorizontal() ? ['class' => $this->getRightColumnClass()] : []; - $wrapperElement = 'html->attributes($wrapperOptions) . '>' . $inputElement . ''; + $wrapperElement = 'html->attributes($wrapperOptions) . '>' . $inputElement . $this->getFieldError($name) . ''; return $this->getFormGroup($name, $label, $wrapperElement); }