1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 00:37:02 +02:00

Correct issue with InputfieldText placeholder attribute sometimes not working for multi-language (like outside the page editor).

This commit is contained in:
Ryan Cramer
2017-06-16 05:56:58 -04:00
parent 1900675bbb
commit e378acc7bc

View File

@@ -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;
}