The entityreference field (field_parent) shows up in node.tpl using print render($content);
, but isn't displayed in search-result.tpl. My search-result.tpl looks like this right now:
<li class="<?php print $classes; ?>"<?php print $attributes; ?>>
<?php print render($title_prefix); ?>
<h3 class="title"<?php print $title_attributes; ?>>
<a href="<?php print $url; ?>"><?php print $title; ?></a>
</h3>
<?php print render($title_suffix); ?>
<div class="submitted">
<div class="imported-text">Imported on <?php print $info_split['date']; ?>.</div>
</div>
<div class="hr"></div>
<div class="content">
<div class="comments-link"><a href="<?php print $url; ?>">Comments</a></div>
<div class="other-content">
<div class="field-name-field-download"><a href="<?php print $result['node']-> field_download[LANGUAGE_NONE][0]['url'] ?>">Download</a></div>
<div class="field-name-field-lipsum"><span class="lipsum">Lipsum:</span> <?php print $result['node']-> field_lipsum[LANGUAGE_NONE][0]['value'] ?></div>
</div>
</div>
</li>
I tried using <?php print $result['node']-> field_parent[LANGUAGE_NONE][0]['value'] ?>
but it gives me the error "Notice: Undefined index: value in include() (line 25 of ...\search-result.tpl.php)."
<?php print $result['node']-> field_parent[LANGUAGE_NONE][0]['entity'] ?>
gives
Recoverable fatal error: Object of class stdClass could not be converted to string in include() (line 25 of ...\search-result.tpl.php).
<?php print $result['node']-> field_parent[LANGUAGE_NONE][0]['entityreference'] ?>
Notice: Undefined index: entityreference in include() (line 25 of ...\search-result.tpl.php).
<?php dpm($result); ?>
to the top ofsearch-result.tpl.php