Fix placeholder of OptionFormText

This commit is contained in:
printempw 2018-06-19 12:34:51 +08:00
parent abde385776
commit c9f9a8ddb2

View File

@ -505,7 +505,8 @@ class OptionFormText extends OptionFormItem
public function placeholder($placeholder = OptionForm::AUTO_DETECT) public function placeholder($placeholder = OptionForm::AUTO_DETECT)
{ {
if ($placeholder == OptionForm::AUTO_DETECT) { if ($placeholder == OptionForm::AUTO_DETECT) {
$placeholder = trans("options.$this->parentId.$this->id.placeholder"); $key = "options.$this->parentId.$this->id.placeholder";
$placeholder = trans()->has($key) ? trans($key) : '';
} }
$this->placeholder = $placeholder; $this->placeholder = $placeholder;
@ -601,7 +602,8 @@ class OptionFormGroup extends OptionFormItem
public function text($id, $value = null, $placeholder = OptionForm::AUTO_DETECT) public function text($id, $value = null, $placeholder = OptionForm::AUTO_DETECT)
{ {
if ($placeholder == OptionForm::AUTO_DETECT) { if ($placeholder == OptionForm::AUTO_DETECT) {
$placeholder = trans("options.$this->parentId.$this->id.placeholder"); $key = "options.$this->parentId.$this->id.placeholder";
$placeholder = trans()->has($key) ? trans($key) : '';
} }
$this->items[] = ['type' => 'text', 'id' => $id, 'value' => $value, 'placeholder' => $placeholder]; $this->items[] = ['type' => 'text', 'id' => $id, 'value' => $value, 'placeholder' => $placeholder];