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
|
* @return array Collection of maps suitable to construct DataObjects
|
||||||
*/
|
*/
|
||||||
function sortData($data, $recordID = null) {
|
function sortData($data, $recordID = null) {
|
||||||
$dataObjects = array();
|
if(!$data) return false;
|
||||||
if($data) {
|
|
||||||
$dataObjects = array();
|
$sortedData = array();
|
||||||
foreach($data as $field => $rowData) {
|
|
||||||
$i = 0;
|
foreach($data as $field => $rowData) {
|
||||||
$blank = 0;
|
$i = 0;
|
||||||
if(!is_array($rowData)) continue;
|
if(!is_array($rowData)) continue;
|
||||||
foreach($rowData as $id => $value) {
|
|
||||||
if($value == '$RecordID') $value = $recordID;
|
foreach($rowData as $id => $value) {
|
||||||
|
if($value == '$recordID') $value = $recordID;
|
||||||
if($value){
|
|
||||||
$dataObjects[$id][$field] = $value;
|
|
||||||
}else{
|
|
||||||
$blank++;
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO ADD stuff for removing rows with incomplete data
|
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