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

Update for Bootstrap 4

Open mikeerickson opened this issue 6 years ago • 9 comments

The current version only supports Bootstrap 3. With Bootstrap 4 the de facto and latest release, this package will be enhanced to provide Bootstrap 4 support

mikeerickson avatar Mar 05 '19 23:03 mikeerickson

Actually they dont need to update for bootstrap 4, see the field basics. You can just replace those classes with any different bootstrap 4 classes.

And it works.

AdamKyle avatar Mar 07 '19 22:03 AdamKyle

@AdamKyle OK, I see what you are referencing here. My position is, we want to support Bootstrap 4 out of the box, as default. This will not affect existing users who have already published preferences as the publishing process will NOT overwrite existing users config.

mikeerickson avatar Mar 08 '19 22:03 mikeerickson

@AdamKyle Further, I am thinking outside the "box" here and trying to create an interface whereby we can support other CSS frameworks (ie Bulma, SemanticUI, etc.) Personally, I tend to use Bulma first as I am looking for something different than the mass amount of Bootstrap looking apps.

mikeerickson avatar Mar 08 '19 22:03 mikeerickson

I provide a Bootstrap 4 template: https://github.com/ycs77/laravel-form-builder-bs4 Used after installation & publish. (If add --force attribute for publishing, will overwrite the Laravel form builder's original config and views)

ycs77 avatar May 02 '19 07:05 ycs77

Link added to Readme https://github.com/kristijanhusak/laravel-form-builder#bootstrap-4-support. Thanks @ycs77 .

kristijanhusak avatar May 02 '19 12:05 kristijanhusak

Your welcome!

ycs77 avatar May 02 '19 12:05 ycs77

@ycs77 This does not seem to work. We have added this package and use Bootstrap 4 but using the "horizontal" update will still render all the radio buttons vertically to their label which looks really bad. In fact, if you look up the Bootstrap code at https://getbootstrap.com/docs/4.0/components/forms/ , it seems that you need to use form-check which is not apparent in the source code at all. And the files of your repository do not update these code parts anyways, as it seems. Any help?

MichaelVoelkel avatar Aug 28 '19 11:08 MichaelVoelkel

Hi @Elypson

Because the publish preset does not overwrite existing files, you can run php artisan vendor:publish --tag=laravel-form-builder-bs4-horizontal --force to force override Laravel form builder's config and views. Although you can switch to horizontal mode, BUT, the original Laravel form builder's config and views in your repository CAN NOT be retrieved. Please think twice.

And I use custom-control instead of form-check. If you are used form-check, you can modify the config after publishing.

ycs77 avatar Aug 29 '19 09:08 ycs77

@ycs77 Okay, I frankly do not see any benefit of your repository and we have removed this from our project. But maybe I overlook something, maybe you could describe your repository's benefit more clearly in your README.md.

What works is to attach the corresponding CSS classes to @kristijanhusak's form. Our main issue lied in choice and this can be fixed with:

$choiceOptions = [
        'wrapper' => ['class' => 'form-check'],
        'label_attr' => ['class' => 'form-check-label'],
        'attr' => ['class' => 'form-check-input']
    ];

When adding a choice, use e.g.:

->add('name', 'choice', ['choice_options' => $choiceOptions]);

Now, everything is fine with @kristijanhusak's repository alone

MichaelVoelkel avatar Aug 30 '19 09:08 MichaelVoelkel