Skip to content

Commit 7e82799

Browse files
committed
Lib: Handle file attachment fields
1 parent bff3430 commit 7e82799

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

quickbase.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,18 @@ final protected static function xml2Arr($xml, &$arr){
386386
$arr[$key] = array();
387387
}
388388

389+
$node = trim(strval($xml->current()));
390+
389391
if($xml->hasChildren()){
390-
$node = array();
392+
if($node !== ''){
393+
$node = array(
394+
'_' => $node
395+
);
396+
}else{
397+
$node = array();
398+
}
391399

392400
self::xml2Arr($xml->current(), $node);
393-
}else{
394-
$node = strval($xml->current());
395401
}
396402

397403
$attrs = $xml->current()->attributes();
@@ -572,7 +578,16 @@ final public static function API_DoQuery(&$query, &$results){
572578
}
573579

574580
foreach($results['table']['records'][$i]['f'] as $key => $field){
575-
$newRecord[$field['id']] = $field['_'];
581+
if(isset($field['url'])){
582+
$value = array(
583+
'filename' => $field['_'],
584+
'url' => $field['url']
585+
);
586+
}else{
587+
$value = $field['_'];
588+
}
589+
590+
$newRecord[$field['id']] = $value;
576591
}
577592

578593
$results['table']['records'][$i] = $newRecord;

0 commit comments

Comments
 (0)