Commit ac8c132d authored by metzlerd's avatar metzlerd
Browse files

Fixed some internationalization issues with entity loading.

parent 7599437e
...@@ -99,9 +99,9 @@ class FrxDrupal extends FrxDataSource { ...@@ -99,9 +99,9 @@ class FrxDrupal extends FrxDataSource {
$data = entity_load($type, $ids); $data = entity_load($type, $ids);
if ($data) foreach ($data as $id => $e) { if ($data) foreach ($data as $id => $e) {
$lang = isset($e->language) ? $e->language : 'und';
if (isset($entity_map[$id])) { if (isset($entity_map[$id])) {
$row_node = $entity_map[$id]; $row_node = $entity_map[$id];
$lang = isset($e->language) ? $e->language : 'und';
foreach ($e as $key => $val) if ($val) { foreach ($e as $key => $val) if ($val) {
if (strpos($key, 'field_') === 0) { if (strpos($key, 'field_') === 0) {
//$fields = field_get_items('node', $node, $key); //$fields = field_get_items('node', $node, $key);
...@@ -118,7 +118,14 @@ class FrxDrupal extends FrxDataSource { ...@@ -118,7 +118,14 @@ class FrxDrupal extends FrxDataSource {
} else if (isset($tmp['value'])) { } else if (isset($tmp['value'])) {
$row_node->addChild($key, $tmp['value']); $row_node->addChild($key, $tmp['value']);
} }
} else if (is_scalar($val)) { } else if (is_array($val) && isset($val['und'])) {
$tmp = $val['und'][0];
if (isset($tmp['safe_value'])) {
$row_node->addChild($key, $tmp['safe_value']);
} else if (isset($tmp['value'])) {
$row_node->addChild($key, $tmp['value']);
}
}else if (is_scalar($val)) {
$row_node->addChild($key, $val); $row_node->addChild($key, $val);
} }
} }
......
...@@ -6,3 +6,4 @@ SELECT nid, type, title, uid, sticky, promote from node WHERE type=:content_type ...@@ -6,3 +6,4 @@ SELECT nid, type, title, uid, sticky, promote from node WHERE type=:content_type
; This demonstrates loading node entities. ; This demonstrates loading node entities.
entity_type = node entity_type = node
entity_id = nid entity_id = nid
type[limit] = int
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment