laravel-form-builder
laravel-form-builder copied to clipboard
Form customization
Hello,
What is the best way to do something like this?
<div class="form-group row">
<label class="col-12" for="example-email-input">Email</label>
<div class="col-md-9">
<input type="email" class="form-control" id="example-email-input" name="example-email-input" placeholder="Email..">
</div>
</div>
I changed config file with this:
'defaults' => [
'wrapper_class' => 'form-group row',
Edited text.php (and other fields files):
<div class="col-md-{{ $options['col-md'] }}">
<?php if ($showField): ?>
<?= Form::input($type, $name, $options['value'], $options['attr']) ?>
<?php include 'help_block.php' ?>
<?php endif; ?>
</div>
Than:
$this
->add('name', 'text', [
'label' => 'Imię',
'label_attr' => ['class' => 'col-12', 'for' => 'example-text-input'],
'col-md' => 9
])
Is a better way to do something like this?