From e378acc7bc21451f3ea4de50a5c3e62e0b4630d4 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 16 Jun 2017 05:56:58 -0400 Subject: [PATCH] Correct issue with InputfieldText placeholder attribute sometimes not working for multi-language (like outside the page editor). --- wire/modules/Inputfield/InputfieldText.module | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wire/modules/Inputfield/InputfieldText.module b/wire/modules/Inputfield/InputfieldText.module index 0ec8c639..4a95d396 100644 --- a/wire/modules/Inputfield/InputfieldText.module +++ b/wire/modules/Inputfield/InputfieldText.module @@ -144,6 +144,15 @@ class InputfieldText extends Inputfield { if(isset($attrs['maxlength']) && (int) $attrs['maxlength'] < 1) unset($attrs['maxlength']); + // placeholder attribute, languages support + if(!empty($attrs['placeholder']) && $this->wire('languages')) { + $language = $this->wire('user')->language; + if($language && $language->id && !$language->isDefault()) { + $placeholder = parent::get("placeholder$language->id"); + if(strlen($placeholder)) $attrs['placeholder'] = $placeholder; + } + } + return $attrs; }