Commit 9373cec4 authored by metzlerd's avatar metzlerd
Browse files

Changed strategy for rendering children. Will work on this further.

Should have field support now. 
parent 9b6af980
......@@ -416,6 +416,16 @@ function forena_save_report($report_name, $report, $save_file = FALSE, $altered
return $save_count;
}
/**
* Render a field without it's containers so that we can use it in a report without the wrappers.
*/
function theme_forena_inline_field(&$variables) {
$element = $variables['field'];
// dpm($variables);
// This is also used in the installer, pre-database setup.
drupal_render_children($variables['field']);
}
/**
* Render a special form with an embedded forena report.
* @param unknown_type $variables
......
......@@ -1326,6 +1326,10 @@ function forena_theme() {
'forena_inline_form_element' => array(
'render element' => 'element',
'file' => 'forena.common.inc',
),
'forena_inline_field' => array(
'render element' => 'field',
'file' => 'forena.common.inc',
),
'forena_fieldset_template' => array(
'render element' => 'fieldset',
......
......@@ -13,12 +13,17 @@ class FrxDrupalNode {
$node = node_load($nid, $vid);
$return = new SimpleXMLElement('<node/>');
$lang = isset($node->language) ? $node->language : 'unk';
if ($node) foreach ($node as $key => $val) {
$display = isset($parms['display']) ? $parms['display'] : 'default';
if ($node) foreach ($node as $key => $val) if ($val) {
if (strpos($key, 'field_') === 0) {
$fields = field_get_items('node', $node, $key);
$output = @field_view_value('node', $node, $key, $fields[0]);
$return->addChild($key, drupal_render($output));
//$fields = field_get_items('node', $node, $key);
$field = field_view_field('node', $node, $key, $display);
$field['#theme'] = array('forena_inline_field');
$value = drupal_render($field);
$f = $return->addChild($key, $value);
if (isset($field['#field_type'])) $f['type'] = $field['#field_type'];
if (isset($field['#field_name'])) $f['name'] = $field['#field_name'];
} else if (is_array($val) && isset($val[$lang])) {
$tmp = $val[$lang][0];
if (isset($tmp['safe_value'])) {
......
Supports Markdown
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