mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Simplified TableField->sortData() code structure (no logic changes) (merged from branches/2.3-nzct)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@82079 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
bc07a4644e
commit
99d6f2241f
@ -471,28 +471,26 @@ class TableField extends TableListField {
|
||||
* @return array Collection of maps suitable to construct DataObjects
|
||||
*/
|
||||
function sortData($data, $recordID = null) {
|
||||
$dataObjects = array();
|
||||
if($data) {
|
||||
$dataObjects = array();
|
||||
foreach($data as $field => $rowData) {
|
||||
$i = 0;
|
||||
$blank = 0;
|
||||
if(!is_array($rowData)) continue;
|
||||
foreach($rowData as $id => $value) {
|
||||
if($value == '$RecordID') $value = $recordID;
|
||||
if(!$data) return false;
|
||||
|
||||
if($value){
|
||||
$dataObjects[$id][$field] = $value;
|
||||
}else{
|
||||
$blank++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$sortedData = array();
|
||||
|
||||
// TODO ADD stuff for removing rows with incomplete data
|
||||
foreach($data as $field => $rowData) {
|
||||
$i = 0;
|
||||
if(!is_array($rowData)) continue;
|
||||
|
||||
foreach($rowData as $id => $value) {
|
||||
if($value == '$recordID') $value = $recordID;
|
||||
|
||||
if($value) $sortedData[$id][$field] = $value;
|
||||
|
||||
$i++;
|
||||
}
|
||||
return $dataObjects;
|
||||
|
||||
// TODO ADD stuff for removing rows with incomplete data
|
||||
}
|
||||
|
||||
return $sortedData;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user