Drupal 7 views_embed_view node.tpl.php fields -
with drupal 7 , views 3, i'm trying result of phone call views_embed_view contextual filter arguments in hook_preprocess_node, embedding node template.
the view using fields display setting, including "content: title" , custom fields. when preview view contextual filter arguments views ui, works expected, when embed view none of node's fields fields api loaded (only built-in attributes title , node id loading).
any thought what's going on here?
sites/all/themes/xxx/template.php
function xxx_preprocess_node(&$vars, $hook) { $node = $vars['node']; $vars['views__deals__single'] = views_embed_view('deals_single', 'page_1', $node->nid); }
sites/all/themes/xxx/templates/node--deal.php
// ... echo 'the view should here:'; echo $views__deals__single; // ...
the result of echo node title, , html wrappers other view fields including labels content empty, unlike in view preview.
help!
you can set straight in node.tpl.php template:
<?php print views_embed_view('deals_single', 'page_1', $node->nid); ?>
drupal drupal-7 drupal-views drupal-fields drupal-templates
No comments:
Post a Comment