Browse Source

Update form.forkbb.php

Visman 2 years ago
parent
commit
a3064a6921
1 changed files with 69 additions and 49 deletions
  1. 69 49
      app/templates/layouts/form.forkbb.php

+ 69 - 49
app/templates/layouts/form.forkbb.php

@@ -12,89 +12,109 @@
             <legend class="f-fleg">{!! __($setVal['legend']) !!}</legend>
             <legend class="f-fleg">{!! __($setVal['legend']) !!}</legend>
         @endif
         @endif
         @foreach ($setVal['fields'] as $key => $cur)
         @foreach ($setVal['fields'] as $key => $cur)
-            @if ('info' === $cur['type'])
+            @switch ($cur['type'])
+                @case ('info')
             <p id="id-{{ $cur['id'] or $setKey.$key }}" class="f-yinfo">{!! __($cur['value']) !!}</p>
             <p id="id-{{ $cur['id'] or $setKey.$key }}" class="f-yinfo">{!! __($cur['value']) !!}</p>
-            @elseif ('wrap' === $cur['type'])
+                    @break
+                @case ('wrap')
             <div id="id-{{ $cur['id'] or $setKey.$key }}" @if ($cur['class']) class="f-wrap-{{ \implode(' f-wrap-', $cur['class']) }}" @endif>
             <div id="id-{{ $cur['id'] or $setKey.$key }}" @if ($cur['class']) class="f-wrap-{{ \implode(' f-wrap-', $cur['class']) }}" @endif>
-            @elseif ('endwrap' === $cur['type'])
+                    @break
+                @case('endwrap')
             </div>
             </div>
-            @else
+                    @break
+                @default
             <dl id="id-dl-{{ $cur['id'] or $key }}" @if ($cur['class']) class="f-field-{{ \implode(' f-field-', $cur['class']) }}" @endif>
             <dl id="id-dl-{{ $cur['id'] or $key }}" @if ($cur['class']) class="f-field-{{ \implode(' f-field-', $cur['class']) }}" @endif>
               <dt> @if ($cur['caption'])<label class="f-ycaption @if ($cur['required']) f-req @endif" @if (false === \strpos('.radio.yield.str.btn.link.', ".{$cur['type']}.")) for="id-{{ $key }}" @endif>{!! __($cur['caption']) !!}</label> @endif</dt>
               <dt> @if ($cur['caption'])<label class="f-ycaption @if ($cur['required']) f-req @endif" @if (false === \strpos('.radio.yield.str.btn.link.', ".{$cur['type']}.")) for="id-{{ $key }}" @endif>{!! __($cur['caption']) !!}</label> @endif</dt>
               <dd>
               <dd>
-                @if ('text' === $cur['type'] || 'email' === $cur['type'])
+                    @switch ($cur['type'])
+                        @case ('text')
+                        @case ('email')
                 <input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif @if ('email' === $cur['type']) autocapitalize="off" @endif class="f-ctrl f-ytxt" id="id-{{ $key }}" name="{{ $key }}" type="text" @if ($cur['maxlength']) maxlength="{{ $cur['maxlength'] }}" @endif @if ($cur['pattern']) pattern="{{ $cur['pattern'] }}" @endif @isset ($cur['value']) value="{{ $cur['value'] }}" @endisset>
                 <input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif @if ('email' === $cur['type']) autocapitalize="off" @endif class="f-ctrl f-ytxt" id="id-{{ $key }}" name="{{ $key }}" type="text" @if ($cur['maxlength']) maxlength="{{ $cur['maxlength'] }}" @endif @if ($cur['pattern']) pattern="{{ $cur['pattern'] }}" @endif @isset ($cur['value']) value="{{ $cur['value'] }}" @endisset>
-                @elseif ('textarea' === $cur['type'])
+                            @break
+                        @case ('textarea')
                 <textarea @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl f-ytxtarea" id="id-{{ $key }}" name="{{ $key }}" @if ($cur['data']) @foreach ($cur['data'] as $k => $v) data-{{ $k }}="{{ $v }}" @endforeach @endif>{{ $cur['value'] or '' }}</textarea>
                 <textarea @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl f-ytxtarea" id="id-{{ $key }}" name="{{ $key }}" @if ($cur['data']) @foreach ($cur['data'] as $k => $v) data-{{ $k }}="{{ $v }}" @endforeach @endif>{{ $cur['value'] or '' }}</textarea>
-                @elseif ('select' === $cur['type'])
+                            @break
+                        @case ('select')
                 <select @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}">
                 <select @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}">
-                    @if (!($count = null) && \is_array(\reset($cur['options'])) && 1 === \count(\reset($cur['options'])) && ($count = 0)) @endif
-                    @foreach ($cur['options'] as $v => $option)
-                        @if (\is_array($option))
-                            @if (null !== $count && 1 === \count($option))
-                                @if (++$count > 1)
+                            @if (!($count = null) && \is_array(\reset($cur['options'])) && 1 === \count(\reset($cur['options'])) && ($count = 0)) @endif
+                            @foreach ($cur['options'] as $v => $option)
+                                @if (\is_array($option))
+                                    @if (null !== $count && 1 === \count($option))
+                                        @if (++$count > 1)
                 </optgroup>
                 </optgroup>
-                                @endif
+                                        @endif
                 <optgroup label="{{ $option[0] }}">
                 <optgroup label="{{ $option[0] }}">
-                            @else
+                                    @else
                   <option value="{{ $option[0] }}" @if ($option[0] == $cur['value']) selected @endif @if ($option[2]) disabled @endif>{{ $option[1] }}</option>
                   <option value="{{ $option[0] }}" @if ($option[0] == $cur['value']) selected @endif @if ($option[2]) disabled @endif>{{ $option[1] }}</option>
-                            @endif
-                        @else
+                                    @endif
+                                @else
                   <option value="{{ $v }}" @if ($v == $cur['value']) selected @endif>{{ $option }}</option>
                   <option value="{{ $v }}" @if ($v == $cur['value']) selected @endif>{{ $option }}</option>
-                        @endif
-                    @endforeach
-                    @if (null !== $count)
+                                @endif
+                            @endforeach
+                            @if (null !== $count)
                 </optgroup>
                 </optgroup>
-                    @endif
+                            @endif
                 </select>
                 </select>
-                @elseif ('multiselect' === $cur['type'])
+                            @break
+                        @case ('multiselect')
                 <select @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif @if ($cur['size']) size="{{ $cur['size'] }}" @endif multiple class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}[]">
                 <select @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif @if ($cur['size']) size="{{ $cur['size'] }}" @endif multiple class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}[]">
-                    @if (!($count = null) && \is_array(\reset($cur['options'])) && 1 === \count(\reset($cur['options'])) && ($count = 0)) @endif
-                    @foreach ($cur['options'] as $v => $option)
-                        @if (\is_array($option))
-                            @if (null !== $count && 1 === \count($option))
-                                @if (++$count > 1)
+                            @if (!($count = null) && \is_array(\reset($cur['options'])) && 1 === \count(\reset($cur['options'])) && ($count = 0)) @endif
+                            @foreach ($cur['options'] as $v => $option)
+                                @if (\is_array($option))
+                                    @if (null !== $count && 1 === \count($option))
+                                        @if (++$count > 1)
                 </optgroup>
                 </optgroup>
-                                @endif
+                                        @endif
                 <optgroup label="{{ $option[0] }}">
                 <optgroup label="{{ $option[0] }}">
-                            @else
+                                    @else
                   <option value="{{ $option[0] }}" @if ((\is_array($cur['value']) && \in_array($option[0], $cur['value'])) || $option[0] == $cur['value']) selected @endif @if ($option[2]) disabled @endif>{{ $option[1] }}</option>
                   <option value="{{ $option[0] }}" @if ((\is_array($cur['value']) && \in_array($option[0], $cur['value'])) || $option[0] == $cur['value']) selected @endif @if ($option[2]) disabled @endif>{{ $option[1] }}</option>
-                            @endif
-                        @else
+                                    @endif
+                                @else
                   <option value="{{ $v }}" @if ((\is_array($cur['value']) && \in_array($v, $cur['value'])) || $v == $cur['value']) selected @endif>{{ $option }}</option>
                   <option value="{{ $v }}" @if ((\is_array($cur['value']) && \in_array($v, $cur['value'])) || $v == $cur['value']) selected @endif>{{ $option }}</option>
-                        @endif
-                    @endforeach
-                    @if (null !== $count)
+                                @endif
+                            @endforeach
+                            @if (null !== $count)
                 </optgroup>
                 </optgroup>
-                    @endif
+                            @endif
                 </select>
                 </select>
-                @elseif ('number' === $cur['type'])
+                            @break
+                        @case ('number')
                 <input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="number" min="{{ $cur['min'] }}" max="{{ $cur['max'] }}" @isset ($cur['value']) value="{{ $cur['value'] }}" @endisset>
                 <input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="number" min="{{ $cur['min'] }}" max="{{ $cur['max'] }}" @isset ($cur['value']) value="{{ $cur['value'] }}" @endisset>
-                @elseif ('checkbox' === $cur['type'])
+                            @break
+                        @case ('checkbox')
                 <label class="f-flblch"><input @if ($cur['autofocus']) autofocus @endif @if ($cur['disabled']) disabled @endif type="checkbox" class="f-ychk" id="id-{{ $key }}" name="{{ $key }}" value="{{ $cur['value'] or '1' }}" @if ($cur['checked']) checked @endif>@isset ($cur['label']){!! __($cur['label']) !!}@endif</label>
                 <label class="f-flblch"><input @if ($cur['autofocus']) autofocus @endif @if ($cur['disabled']) disabled @endif type="checkbox" class="f-ychk" id="id-{{ $key }}" name="{{ $key }}" value="{{ $cur['value'] or '1' }}" @if ($cur['checked']) checked @endif>@isset ($cur['label']){!! __($cur['label']) !!}@endif</label>
-                @elseif ('radio' === $cur['type'])
-                    @foreach ($cur['values'] as $v => $n)
+                            @break
+                        @case ('radio')
+                            @foreach ($cur['values'] as $v => $n)
                 <label class="f-flblr"><input @if ($cur['autofocus']) autofocus @endif @if ($cur['disabled']) disabled @endif type="radio" class="f-yradio" id="id-{{ $key }}-{{ $v }}" name="{{ $key }}" value="{{ $v }}" @if ($v == $cur['value']) checked @endif>{{ $n }}</label>
                 <label class="f-flblr"><input @if ($cur['autofocus']) autofocus @endif @if ($cur['disabled']) disabled @endif type="radio" class="f-yradio" id="id-{{ $key }}-{{ $v }}" name="{{ $key }}" value="{{ $v }}" @if ($v == $cur['value']) checked @endif>{{ $n }}</label>
-                    @endforeach
-                @elseif ('password' === $cur['type'])
+                            @endforeach
+                            @break
+                        @case ('password')
                 <input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="password" @if ($cur['maxlength']) maxlength="{{ $cur['maxlength'] }}" @endif @if ($cur['pattern']) pattern="{{ $cur['pattern'] }}" @endif @isset ($cur['value']) value="{{ $cur['value'] }}" @endisset>
                 <input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="password" @if ($cur['maxlength']) maxlength="{{ $cur['maxlength'] }}" @endif @if ($cur['pattern']) pattern="{{ $cur['pattern'] }}" @endif @isset ($cur['value']) value="{{ $cur['value'] }}" @endisset>
-                @elseif ('btn' === $cur['type'])
+                            @break
+                        @case ('btn' === $cur['type'])
                 <a class="f-btn f-ybtn @if ($cur['disabled']) f-disabled @endif" href="{{ $cur['link'] or '' }}" title="{{ $cur['title'] or '' }}" @if ($cur['disabled']) tabindex="-1" @endif>{{ $cur['value'] }}</a>
                 <a class="f-btn f-ybtn @if ($cur['disabled']) f-disabled @endif" href="{{ $cur['link'] or '' }}" title="{{ $cur['title'] or '' }}" @if ($cur['disabled']) tabindex="-1" @endif>{{ $cur['value'] }}</a>
-                @elseif ('str' === $cur['type'])
+                            @break
+                        @case ('str')
                 <p class="f-str" id="id-{{ $key }}"> @if ($cur['html']){!! $cur['value'] !!} @else{{ $cur['value'] }} @endif</p>
                 <p class="f-str" id="id-{{ $key }}"> @if ($cur['html']){!! $cur['value'] !!} @else{{ $cur['value'] }} @endif</p>
-                @elseif ('link' === $cur['type'])
+                            @break
+                        @case ('link')
                 <a class="f-link" id="id-{{ $key }}" href="{{ $cur['href'] or '' }}" @isset ($cur['rel']) rel="{{ $cur['rel'] }}" @endisset title="{{ $cur['title'] or '' }}">{{ $cur['value'] or '' }}</a>
                 <a class="f-link" id="id-{{ $key }}" href="{{ $cur['href'] or '' }}" @isset ($cur['rel']) rel="{{ $cur['rel'] }}" @endisset title="{{ $cur['title'] or '' }}">{{ $cur['value'] or '' }}</a>
-                @elseif ('yield' === $cur['type'])
+                            @break
+                        @case ('yield')
                 {!! $this->block($cur['value']) !!}
                 {!! $this->block($cur['value']) !!}
-                @elseif ('file' === $cur['type'])
+                            @break
+                        @case ('file')
                 <input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="file" @if ($cur['accept']) accept="{{ $cur['accept'] }}" @endif>
                 <input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="file" @if ($cur['accept']) accept="{{ $cur['accept'] }}" @endif>
-                @endif
-                @if ($cur['help'])
+                            @break
+                    @endswitch
+                    @if ($cur['help'])
                 <p class="f-yhint">{!! __($cur['help']) !!}</p>
                 <p class="f-yhint">{!! __($cur['help']) !!}</p>
-                @endif
+                    @endif
               </dd>
               </dd>
             </dl>
             </dl>
-            @endif
+                    @break
+            @endswitch
         @endforeach
         @endforeach
           </fieldset>
           </fieldset>
     @endif
     @endif