Skip to content

Commit b438a29

Browse files
committed
Added customize class
1 parent 7ec373e commit b438a29

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

src/LaravelUikitForm.php

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public static function textarea($name, $value = false, $label = false, $id = fal
3737
'name' => $name,
3838
'label' => $form->helper->label($label, $name),
3939
'id' => $form->helper->id($id, $name),
40+
'class' => (is_array($attributes) && key_exists('class', $attributes)),
4041
'attributes' => $form->helper->attributes($attributes),
4142
'value' => $form->helper->value($value),
4243
'rows' => $form->helper->rows($rows),
@@ -51,6 +52,7 @@ public static function select($name, $options, $value = false, $label = false, $
5152
'name' => $name,
5253
'label' => $form->helper->label($label, $name),
5354
'id' => $form->helper->id($id, $name),
55+
'class' => (is_array($attributes) && key_exists('class', $attributes)),
5456
'attributes' => $form->helper->attributes($attributes),
5557
'attributesArray' => (!$attributes) ? [] : $attributes,
5658
'value' => $form->helper->value($value),
@@ -66,6 +68,7 @@ public static function checkbox($name, $value = false, $label = false, $id = fal
6668
'name' => $name,
6769
'label' => $form->helper->label($label, $name),
6870
'id' => $form->helper->id($id, $name),
71+
'class' => (is_array($attributes) && key_exists('class', $attributes)),
6972
'attributes' => $form->helper->attributes($attributes),
7073
'value' => $form->helper->value($value),
7174
])->render();
@@ -79,6 +82,7 @@ public static function radio($name, $value = false, $checked = false, $label = f
7982
'name' => $name,
8083
'label' => $form->helper->label($label, $name),
8184
'id' => $form->helper->id($id, $name),
85+
'class' => (is_array($attributes) && key_exists('class', $attributes)),
8286
'attributes' => $form->helper->attributes($attributes),
8387
'value' => $form->helper->value($value),
8488
'checked' => (bool)$checked

src/views/checkbox.blade.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<div class="uk-margin-small-bottom">
22
<label @if($id)for="{{$id}}"@endif>
3-
<input class="uk-checkbox" type="checkbox"
4-
@if($id)id="{{ $id }}"@endif
5-
@if($name)name="{{ $name }}"@endif
3+
<input type="checkbox"
4+
@if(!$class)class="uk-checkbox"@endif
5+
@if($id)id="{{ $id }}"@endif
6+
@if($name)name="{{ $name }}"@endif
67
value="{{ $value }}"{!! $attributes !!}> {{ $label }}
78
</label>
89
</div>

src/views/radio.blade.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<div class="uk-margin-small-bottom">
22
<label @if($id)for="{{$id}}"@endif>
3-
<input class="uk-radio" type="radio"
3+
<input
4+
type="radio"
5+
@if(!$class)class="uk-radio"@endif
46
@if($id)id="{{ $id }}"@endif
57
@if($name)name="{{ $name }}"@endif
68
value="{{ $value }}"{!! $attributes !!}@if($checked) checked @endif> {{ $label }}

src/views/select.blade.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<div class="uk-margin-small-bottom">
22
<label @if($id)for="{{$id}}"@endif>{{$label}}</label>
33
<div class="uk-form-controls">
4-
<select class="uk-select" @if($id)id="{{$id}}"@endif @if($name)name="{{$name}}"@endif{!! $attributes !!}>
4+
<select
5+
@if(!$class)class="uk-select"@endif
6+
@if($id)id="{{$id}}"@endif
7+
@if($name)name="{{$name}}"@endif{!! $attributes !!}>
58
<option {!! (is_array($attributesArray) && key_exists('v-model', $attributesArray)) ? ':value="null"' : 'value=""' !!}>- choice -</option>
69
@foreach($options as $valueOption => $name)
710
<option value="{{$valueOption}}"{!! ($valueOption == $value || (is_array($value) && !empty($value[$valueOption]))) ? ' selected' : '' !!}>

src/views/textarea.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<label @if($id)for="{{$id}}"@endif>{{ $label }}</label>
33
<div class="uk-form-controls">
44
<textarea rows="{{ $rows }}"
5-
class="uk-textarea"
5+
@if(!$class)class="uk-textarea"@endif
66
@if($name)name="{{$name}}"@endif
77
@if($id)id="{{$id}}"@endif
88
{!! $attributes !!}>{{$value}}</textarea>

0 commit comments

Comments
 (0)