laravel-form-builder icon indicating copy to clipboard operation
laravel-form-builder copied to clipboard

Form customization

Open ekstro opened this issue 6 years ago • 0 comments

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?

ekstro avatar Jan 06 '19 17:01 ekstro