l am working on a Drupal 7 site with a custom video block called a leaf. It allows the admin the ability to add Text, Photos and Video. When I add video, it functions properly, but I get the below error.
Strict warning: Only variables should be passed by reference in include() (line 27 of /var/www/vhosts/xxxxxxxxxxx.com/sites/default/themes/custom_theme/templates/views-view-field--leaf-block--nid.tpl.php)
I researched the error and came across similar instances, but the php is a bit over my head.
The code currently reads as:
<?php endif; ?>
<?php
$node_to_load = node_load($row->nid);
//line 27 below
print drupal_render(node_view($node_to_load));
?>
I believe that render needs a reference so as is it is invalid, but I am not sure how to accurately assign the return value or the correct syntax. My attempt is below, but is incorrect.
<?php
$node_to_load = node_load($row->nid);
{
nid++;
}
$reference=$something
node_to_load($reference);
// $something to reference????
?>
Does anyone have any suggestions or advise that would help me? This error doesn’t appear to interrupt the functionality of the videos once added but I would love to clean up the code if possible and understand the situation more.
Thanks,
try this:
<?php
$node_to_load = node_load($row->nid);
$node_view = node_view($node_to_load);
print drupal_render($node_view);
?>
As you can see in the docs, drupal_render
uses a reference.