update widget form add back button
parent
11bcca4213
commit
56ee1dcb4d
|
|
@ -140,7 +140,7 @@ class Form implements Renderable
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $buttons = ['reset' => true, 'submit' => true];
|
||||
protected $buttons = ['reset' => true, 'submit' => true, 'back' => false];
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
|
@ -489,6 +489,13 @@ class Form implements Renderable
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function backButton(bool $value = true)
|
||||
{
|
||||
$this->buttons['back'] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable reset button.
|
||||
*
|
||||
|
|
@ -500,6 +507,11 @@ class Form implements Renderable
|
|||
return $this->resetButton(! $value);
|
||||
}
|
||||
|
||||
public function disableBackButton(bool $value = true)
|
||||
{
|
||||
return $this->backButton(! $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable submit button.
|
||||
*
|
||||
|
|
@ -623,7 +635,7 @@ class Form implements Renderable
|
|||
return <<<HTML
|
||||
<div class="box-footer row d-flex">
|
||||
<div class="col-md-2"> </div>
|
||||
<div class="col-md-8">{$this->renderResetButton()}{$this->renderSubmitButton()}</div>
|
||||
<div class="col-md-8">{$this->renderBackButton()}{$this->renderResetButton()}{$this->renderSubmitButton()}</div>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
|
@ -644,6 +656,15 @@ HTML;
|
|||
}
|
||||
}
|
||||
|
||||
protected function renderBackButton()
|
||||
{
|
||||
if (! empty($this->buttons['back'])) {
|
||||
$back = trans('admin.back');
|
||||
|
||||
return "<a href=\"javascript: window.history.back()\" class=\"btn btn-white pull-left\"><i class=\"feather icon-arrow-left\"></i> {$back}</a>";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交按钮文本.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue