mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR: #2322 - Editable Checkbox Groups in user defined forms should display the field's name, not
a pointless number (DanielVF) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@56942 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5ec9ff8862
commit
9faf153965
@ -124,24 +124,26 @@ class EditableCheckboxGroupField extends EditableFormField {
|
||||
return $checkboxSet;
|
||||
}
|
||||
|
||||
function getValueFromData( $data ) {
|
||||
if( empty( $data[$this->Name] ) ) {
|
||||
function getValueFromData($data) {
|
||||
if(empty($data[$this->Name])) {
|
||||
return "";
|
||||
}
|
||||
|
||||
$entries = $data[$this->Name];
|
||||
|
||||
if( !is_array( $data[$this->Name] ) ) {
|
||||
$entries = array( $data[$this->Name] );
|
||||
if(!is_array($data[$this->Name])) {
|
||||
$entries = array($data[$this->Name]);
|
||||
}
|
||||
|
||||
$selectedOptions = DataObject::get( 'EditableCheckboxOption', "ParentID={$this->ID} AND ID IN (".implode(',',$entries).")" );
|
||||
foreach( $selectedOptions as $selected ) {
|
||||
if( !$result )
|
||||
$result = $selected->ID;
|
||||
else
|
||||
$result .= "," . $selected->ID;
|
||||
$selectedOptions = DataObject::get('EditableCheckboxOption', "ParentID={$this->ID} AND ID IN (" . implode(',', $entries) . ")");
|
||||
foreach($selectedOptions as $selected) {
|
||||
if(!$result) {
|
||||
$result = $selected->Title;
|
||||
} else {
|
||||
$result .= "," . $selected->Title;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -149,5 +151,6 @@ class EditableCheckboxGroupField extends EditableFormField {
|
||||
$option = new EditableCheckboxOption();
|
||||
return $option->EditSegment();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user