diff --git a/include/class.forms.php b/include/class.forms.php index 1ee044aa1d834d7ac6ef848bf86a635a8c693b2b..107cea8bf25acddfc36821ad400f700f7c002e25 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -597,6 +597,8 @@ class FormField { function getClean() { if (!isset($this->_clean)) { $this->_clean = (isset($this->value)) + // XXX: The widget value may be parsed already if this is + // linked to dynamic data via ::getAnswer() ? $this->value : $this->parse($this->getWidget()->value); if ($vs = $this->get('cleaners')) { @@ -2065,6 +2067,8 @@ class PriorityField extends ChoiceField { } function to_php($value, $id=false) { + if ($value instanceof Priority) + return $value; if (is_array($id)) { reset($id); $id = key($id); @@ -2083,6 +2087,13 @@ class PriorityField extends ChoiceField { : $prio; } + function display($prio) { + if (!$prio instanceof Priority) + return parent::display($prio); + return sprintf('<span style="padding: 2px; background-color: %s">%s</span>', + $prio->getColor(), Format::htmlchars($prio->getDesc())); + } + function toString($value) { return ($value instanceof Priority) ? $value->getDesc() : $value; }