jqh 4 vuotta sitten
vanhempi
commit
5c2f959cb3
3 muutettua tiedostoa jossa 16 lisäystä ja 14 poistoa
  1. 1 0
      .travis.yml
  2. 1 1
      src/Support/Helper.php
  3. 14 13
      src/Widgets/Form.php

+ 1 - 0
.travis.yml

@@ -6,6 +6,7 @@ php:
   - 7.1
   - 7.2
   - 7.3
+  - 7.4
 
 addons:
   chrome: stable

+ 1 - 1
src/Support/Helper.php

@@ -327,7 +327,7 @@ class Helper
      */
     public static function slug(string $name, string $symbol = '-')
     {
-        $text = preg_replace_callback('/([A-Z])/', function (&$text) use ($symbol) {
+        $text = preg_replace_callback('/([A-Z])/', function ($text) use ($symbol) {
             return $symbol.strtolower($text[1]);
         }, $name);
 

+ 14 - 13
src/Widgets/Form.php

@@ -629,27 +629,28 @@ class Form implements Renderable
             return;
         }
 
-        $buttons = '';
+        return <<<HTML
+<div class="box-footer row d-flex">
+    <div class="col-md-2"> &nbsp;</div>
+    <div class="col-md-8">{$this->renderResetButton()}{$this->renderSubmitButton()}</div>
+</div>
+HTML;
+    }
 
+    protected function renderResetButton()
+    {
         if (! empty($this->buttons['reset'])) {
             $reset = trans('admin.reset');
 
-            $buttons .= "<button type=\"reset\" class=\"btn btn-white pull-left\"><i class=\"feather icon-rotate-ccw\"></i> {$reset}</button>";
+            return "<button type=\"reset\" class=\"btn btn-white pull-left\"><i class=\"feather icon-rotate-ccw\"></i> {$reset}</button>";
         }
+    }
 
+    protected function renderSubmitButton()
+    {
         if (! empty($this->buttons['submit'])) {
-            $submit = $this->getSubmitButtonLabel();
-
-            $buttons .= "<button type=\"submit\" class=\"btn btn-primary pull-right\"><i class=\"feather icon-save\"></i> {$submit}</button>";
+            return "<button type=\"submit\" class=\"btn btn-primary pull-right\"><i class=\"feather icon-save\"></i> {$this->getSubmitButtonLabel()}</button>";
         }
-
-        return <<<HTML
-<div class="box-footer row d-flex">
-    <div class="col-md-2"> &nbsp;</div>
-
-    <div class="col-md-8">{$buttons}</div>
-</div>
-HTML;
     }
 
     /**