1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-15 19:24:28 +02:00

Add enhancement processwire/processwire-issues#596 show field labels rather than field names in Inputfield error messages

This commit is contained in:
Ryan Cramer
2018-05-21 09:23:47 -04:00
parent 2ba8d29ce2
commit 79fa81d8a8

View File

@@ -1458,7 +1458,9 @@ abstract class Inputfield extends WireData implements Module {
$errors[] = $text; $errors[] = $text;
$this->wire('session')->set($key, $errors); $this->wire('session')->set($key, $errors);
} }
$text .= $this->name ? " ($this->name)" : ""; $label = $this->getSetting('label');
if(empty($label)) $label= $this->attr('name');
if(strlen($label)) $text .= " - $label";
return parent::error($text, $flags); return parent::error($text, $flags);
} }