File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5151 */
5252 'themes ' => [
5353 /**
54- * Default configuration for the Twitter Bootstrap framework
54+ * Default configuration for Bootstrap v3
5555 */
5656 'bootstrap ' => [
5757 /*
7373 'checkbox ' => '' ,
7474 'error ' => 'input-with-feedback '
7575 ],
76+ ],
77+ /**
78+ * Default configuration for Bootstrap v4
79+ */
80+ 'bootstrap4 ' => [
81+ /*
82+ * Set a specific HTML template for a field type if the
83+ * type is not set, the default template will be used
84+ */
85+ 'field_templates ' => [
86+ // type => template
87+ 'checkbox ' => 'checkbox ' ,
88+ 'checkboxes ' => 'collections ' ,
89+ 'radios ' => 'collections '
90+ ],
91+ /*
92+ * Set the default classes for each field type
93+ */
94+ 'field_classes ' => [
95+ // type => class or classes
96+ 'default ' => 'form-control ' ,
97+ 'checkbox ' => '' ,
98+ 'error ' => 'input-with-feedback '
99+ ],
76100 ]
77101 ]
78102
Original file line number Diff line number Diff line change @@ -31,12 +31,16 @@ class HtmlBuilder extends CollectiveHtmlBuilder
3131 * If no classes are evaluated as TRUE then this function will return an
3232 * empty string.
3333 *
34- * @param array $classes
34+ * @param array|mixed $classes
3535 *
3636 * @return string
3737 */
38- public function classes (array $ classes )
38+ public function classes ($ classes )
3939 {
40+ if (! is_array ($ classes )) {
41+ $ classes = func_get_args ();
42+ }
43+
4044 $ html = '' ;
4145
4246 foreach ($ classes as $ name => $ bool ) {
Original file line number Diff line number Diff line change @@ -89,7 +89,8 @@ protected function loadConfigurationOptions()
8989
9090 $ this ->options = $ this ->app ->make ('config ' )->get ('html ' );
9191
92- $ this ->options ['theme_values ' ] = $ this ->options ['themes ' ][$ this ->options ['theme ' ]];
92+ $ this ->options ['theme_values ' ] = array_get ($ this ->options ['themes ' ], $ this ->options ['theme ' ]);
93+
9394 unset ($ this ->options ['themes ' ]);
9495 }
9596
Original file line number Diff line number Diff line change 1+ @foreach ($messages as $msg )
2+ <div class =" alert alert-{{ $msg [' type' ] } } alert-dismissible fade show" >
3+ <button type =" button" class =" close" data-dismiss =" alert" aria-label =" Close" >
4+ <span aria-hidden =" true" >× ; </span >
5+ </button >
6+ <strong >{{ $msg [' message' ] } } </strong >
7+
8+ @if (! empty ($msg [' details' ]) )
9+ <p >{{ $msg [' details' ] } } </p >
10+ @endif
11+
12+ {!! $msg [' html' ] ! !}
13+
14+ @if (! empty ($msg [' items' ]) )
15+ <ul >
16+ @foreach ($msg [' items' ] as $item )
17+ <li >{{ $item } } </li >
18+ @endforeach
19+ </ul >
20+ @endif
21+
22+ @if ( ! empty ($msg [' buttons' ]) )
23+ <p >
24+ @foreach ($msg [' buttons' ] as $btn )
25+ <a class =" btn btn-{{ $btn [' class' ] } }" href =" {{ $btn [' url' ] } }" >{{ $btn [' text' ] } } </a >
26+ @endforeach
27+ </p >
28+ @endif
29+ </div >
30+ @endforeach
Original file line number Diff line number Diff line change 1+ <div id =" field_{{ $id } }" {!! Html:: classes ([' checkbox' , ' error' => $hasErrors ]) ! !} >
2+ <label >
3+ {!! $input ! !}
4+ {{ $label } }
5+ </label >
6+
7+ @if ($required )
8+ <span class =" label label-info" >Required</span >
9+ @endif
10+
11+ @if (! empty ($errors ) )
12+ <div class =" controls" >
13+ @foreach ($errors as $error )
14+ <p class =" help-block" >{{ $error } } </p >
15+ @endforeach
16+ </div >
17+ @endif
18+ </div >
Original file line number Diff line number Diff line change 1+ <h4 >{{ $label } } </h4 >
2+
3+ {!! $input ! !}
4+
5+ @if ( ! empty ($errors ) )
6+ <div class =" controls" >
7+ @foreach ($errors as $error )
8+ <p class =" help-block" >{{ $error } } </p >
9+ @endforeach
10+ </div >
11+ @endif
12+
13+ <hr >
Original file line number Diff line number Diff line change 1+ <div id =" field_{{ $id } }" {!! Html:: classes ([' form-group' , ' has-error' => $hasErrors ]) ! !} >
2+ <label for =" {{ $id } }" class =" control-label" >
3+ {{ $label } }
4+ </label >
5+
6+ @if ($required )
7+ <span class =" label label-info" >Required</span >
8+ @endif
9+
10+ <div class =" controls" >
11+ {!! $input ! !}
12+ @foreach ($errors as $error )
13+ <p class =" help-block" >{{ $error } } </p >
14+ @endforeach
15+ </div >
16+ </div >
Original file line number Diff line number Diff line change 1+ @foreach ($checkboxes as $checkbox )
2+ <label class =" checkbox-inline" >
3+ {!! Form:: checkbox (
4+ $checkbox [' name' ],
5+ $checkbox [' value' ],
6+ $checkbox [' checked' ],
7+ [' id' => $checkbox [' id' ]]
8+ ) ! !}
9+ {{ $checkbox [' label' ] } }
10+ </label >
11+ @endforeach
Original file line number Diff line number Diff line change 1+ @foreach ($checkboxes as $checkbox )
2+ <div class =" checkbox" >
3+ <label >
4+ {!! Form:: checkbox (
5+ $checkbox [' name' ],
6+ $checkbox [' value' ],
7+ $checkbox [' checked' ],
8+ [' id' => $checkbox [' id' ]]
9+ ) ! !}
10+ {{ $checkbox [' label' ] } }
11+ </label >
12+ </div >
13+ @endforeach
Original file line number Diff line number Diff line change 1+ @foreach ($radios as $radio )
2+ <label class =" radio-inline" >
3+ {!! Form:: radio (
4+ $radio [' name' ],
5+ $radio [' value' ],
6+ $radio [' selected' ],
7+ [' id' => $radio [' id' ]]
8+ ) ! !}
9+ {{ $radio [' label' ] } }
10+ </label >
11+ @endforeach
You can’t perform that action at this time.
0 commit comments