Skip to content

fill() isn't populating checkboxes - fix #75 #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0e5e984
Merge pull request #1 from netojose/master
snickbit Jul 9, 2019
058f9a7
added support for Bootstrap 4 Custom Forms
snickbit Jul 10, 2019
cc9d744
removed dd function
snickbit Jul 10, 2019
6740bfb
Update FormBuilder.php
kaziu687 Sep 16, 2019
0174879
Private functions to protected
Oct 21, 2019
ceb94d1
Updated package name
Oct 21, 2019
6d9afcd
Input group implementation
joserick Apr 12, 2020
67fcfe2
Fix label
joserick Apr 12, 2020
4571047
Fix multidimensional form validation
Apr 24, 2020
60d30d4
Added attributes
joserick Apr 28, 2020
869e329
Fix syntax
joserick Apr 28, 2020
107e748
Fix closed and opened brackets
Apr 30, 2020
48ba24d
Fix Error Messages
May 7, 2020
cff8279
Fix function parameter
joserick May 19, 2020
9624ae5
Added use brackets for multiple attribute
joserick May 19, 2020
9db8ec8
Added function optgroup
joserick May 23, 2020
2a057f0
Added documentation for undocumented feature
szeplakig May 26, 2020
57518a5
Merge pull request #2 from gaetanololli/master
kaziu687 Jun 22, 2020
60cf817
Merge pull request #3 from Procok/patch-1
kaziu687 Jun 22, 2020
6aef9a4
pre-merge
Jun 22, 2020
e565528
fix #88
Jun 22, 2020
da4823b
Merge pull request #7 from kaziu687/pre-merge
kaziu687 Jun 22, 2020
b4f1d5b
pre-merge
Jun 22, 2020
2dfb0e4
Merge branch 'joserick-master' into pre-merge
Jun 22, 2020
5ffa457
Merge pull request #9 from kaziu687/pre-merge
kaziu687 Jun 22, 2020
a1432d5
pre-merge
Jun 23, 2020
44d1f67
Merge branch 'custom-forms' of https://github.com/snickbit/laravel-bo…
Jun 23, 2020
39aceaa
Merge pull request #11 from kaziu687/snickbit-custom-forms
kaziu687 Jun 23, 2020
c3ea6ba
Added TwigBridge support, updated readme
Jun 24, 2020
0307d5d
Update FormBuilder.php
kaziu687 Jan 9, 2021
7850a68
Update FormBuilder.php
kaziu687 Jan 10, 2021
6b26f45
Fix invisible select option if value is equal 0
kaziu687 Jan 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 112 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Total Downloads][ico-downloads]][link-downloads]

This is a package for creating Bootstrap 4 styled form elements in Laravel 5/6.
This is a package for creating Bootstrap 4 styled form elements in Laravel 5/6.
Forked from https://github.com/netojose/laravel-bootstrap-4-forms that seems abandoned.
Contains unmerged pull request from original repository:
https://github.com/netojose/laravel-bootstrap-4-forms/pull/102
https://github.com/netojose/laravel-bootstrap-4-forms/pull/99
https://github.com/netojose/laravel-bootstrap-4-forms/pull/97
https://github.com/netojose/laravel-bootstrap-4-forms/pull/86

## Features

- Labels
- Error messages
- Bootstrap 4 markup and classes (including state, colors, and sizes)
- Bootstrap 4 markup and classes (including state, colors, grouping and sizes)
- Error validation messages
- Form fill (using Model instance, array or after form submission when a validation error occurs)
- Internationalization
- Add parameters using php chaining approach
- Zero dependences (no Laravel Collective dependency)
- Optional [TwigBridge](https://github.com/rcrowe/TwigBridge) extension

## Introduction

Expand Down Expand Up @@ -73,6 +80,17 @@ If you is using Laravel 5.5, the auto discovery feature will make everything for
],
```

#### [Optional] Add TwigBridge support to config/twigbridge.php:

```php
'extensions' => [
//...
'enabled' => [
'NetoJose\Bootstrap4Forms\Extension\TwigBridge'
]
],
```

## Usage

### Basic form controls
Expand All @@ -99,6 +117,16 @@ If you is using Laravel 5.5, the auto discovery feature will make everything for
{!!Form::open()->formInline(false)!!}
```

#### Multipart form

```php
// Changes enctype of form to "multipart/form-data"
{!!Form::open()->multipart()!!}

// You can use FALSE to turn off form multipart
{!!Form::open()->multipart(false)!!}
```

#### Fieldset

| Param | Type | Default | Description |
Expand Down Expand Up @@ -879,6 +907,75 @@ Set max attribute for input
{!!Form::text('name', 'Name')->disableIsValid()!!}
```

### Input group
Currently it only works with Select and Inputs of text, date, time, tel and url.

### Append
| Param | Type | Default | Description |
|---------|--------|---------|-------------------------|
| $append | string | null | Append text |
| $attrs | array | null | Append input attributes |

```php
// Example
{!!Form::text('name', 'Name')->append('Input group append')!!}

{!!Form::tel('phone', 'Phone')->append('<em>Input group append</em>')!!}
```

### Prepend
| Param | Type | Default | Description |
|----------|--------|---------|--------------------------|
| $prepend | string | null | Prepend text |
| $attrs | array | null | Prepend input attributes |

```php
// Example
{!!Form::select('cars', 'Cars', [])->prepend('Input group prepend')!!}

{!!Form::date('date', 'Date')->prepend('<strong>Input group append</strong>')!!}
```

### Group attributes in wrapper div
| Param | Type | Default | Description |
|:------:|:-----:|:-------:|:----------------------:|
| $attrs | array | null | Group input attributes |

```php
// Example
{!!Form::text('name', 'Name')->prepend('Input group')
->wrapperGroupAttrs([['id'=> 'group-wrapper']])!!}

// will output <div class="input-group">...</div>
```

### Append attributes in wrapper div
| Param | Type | Default | Description |
|:------:|:-----:|:-------:|:----------------------:|
| $attrs | array | null | Append input attributes |

```php
// Example
{!!Form::text('name', 'Name')->append('Input group append')
->wrapperAppendAttrs([['id'=> 'append-wrapper']])!!}


// will output <div class="input-group-append">...</div>
```

### Prepend attributes in wrapper div
| Param | Type | Default | Description |
|:------:|:-----:|:-------:|:----------------------:|
| $attrs | array | null | Prepend input attributes |

```php
// Example
{!!Form::text('name', 'Name')->append('Input group prepend')
->wrapperPrependAttrs([['id'=> 'prepend-wrapper']])!!}

// will output <div class="input-group-append">...</div>
```

### Chaining properties

You can use chaining feature to use a lot of settings for each component
Expand All @@ -897,7 +994,19 @@ You can use chaining feature to use a lot of settings for each component
{!!Form::close()!!}
```

### Use in Twig templates
```
// Examples

{{ form_open().put().multipart().route('user.add').fill(user) | raw }}

{{ form_text('name', 'Name').placeholder('Type your name').lg() | raw }}
{{ form_submit('Save') }}

{{ form_close() }}
```

[ico-version]: https://img.shields.io/packagist/v/netojose/laravel-bootstrap-4-forms.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/netojose/laravel-bootstrap-4-forms.svg?style=flat-square
[link-packagist]: https://packagist.org/packages/netojose/laravel-bootstrap-4-forms
[link-downloads]: https://packagist.org/packages/netojose/laravel-bootstrap-4-forms
[link-downloads]: https://packagist.org/packages/netojose/laravel-bootstrap-4-forms
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "netojose/laravel-bootstrap-4-forms",
"name": "kaziu687/laravel-bootstrap-4-forms",
"type": "package",
"description": "Bootstrap 4 form builder for Laravel 5",
"keywords": [
Expand Down
28 changes: 28 additions & 0 deletions src/Extension/TwigBridge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
namespace NetoJose\Bootstrap4Forms\Extension;

use \NetoJose\Bootstrap4Forms\FormService;
use TwigBridge\Extension\Laravel\Form;

/**
* Access Laravels bootstrap themed form builder in Twig templates
*
* Add 'NetoJose\Bootstrap4Forms\Extension\TwigBridge' to TwigBridge config at extension section
*/
class TwigBridge extends Form
{
/**
* @var FormService
*/
protected $form;

/**
* Create a new form extension
*
* @param FormService $form
*/
public function __construct(FormService $form)
{
$this->form = $form;
}
}
Loading