Skip to content
Snippets Groups Projects
Commit 470949cc authored by Jared Hancock's avatar Jared Hancock
Browse files

forms: Disconnect toString() and getChoice() functionality

parent ef2e481d
No related branches found
No related tags found
No related merge requests found
...@@ -786,7 +786,9 @@ class ChoiceField extends FormField { ...@@ -786,7 +786,9 @@ class ChoiceField extends FormField {
} }
function toString($value) { function toString($value) {
return (string) $this->getChoice($value); $selection = $this->getChoice($value);
return is_array($selection) ? implode(', ', array_filter($selection))
: (string) $selection;
} }
function getChoice($value) { function getChoice($value) {
...@@ -800,7 +802,7 @@ class ChoiceField extends FormField { ...@@ -800,7 +802,7 @@ class ChoiceField extends FormField {
elseif ($this->get('default')) elseif ($this->get('default'))
$selection[] = $choices[$this->get('default')]; $selection[] = $choices[$this->get('default')];
return $selection ? implode(', ', array_filter($selection)) : ''; return $selection;
} }
function getChoices($verbose=false) { function getChoices($verbose=false) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment