Skip to content

Commit

Permalink
Fix passing classes to labels
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebronner committed Nov 7, 2017
1 parent 1b22afb commit 3c6c6d8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Label.php
Expand Up @@ -13,18 +13,16 @@ public function __construct(string $name, $value = null, array $options = [], bo
$value = str_replace('_id', '', $value);
$value = str_replace('[]', '', $value);
$value = $options['label'] ?? (ucwords($value) ?: '');
$options['class'] = '';
$options['class'] = $options['class'] ?? '';

parent::__construct($name, $value, $options);

$this->classes = '';

if ($this->framework === 'bootstrap3') {
$this->classes = 'col-sm-' . app('form')->labelWidth . ' control-label';
$options['class'] .= ' col-sm-' . app('form')->labelWidth . ' control-label';
}

if ($this->framework === 'bootstrap4') {
$this->classes = 'col-sm-' . app('form')->labelWidth . ' col-form-label';
$options['class'] .= ' col-sm-' . app('form')->labelWidth . ' col-form-label';
}

$this->excludedKeys = $this->excludedKeys->merge(collect([
Expand Down

0 comments on commit 3c6c6d8

Please sign in to comment.