Get instance of referenced entity

Submitted by august on Sat, 01/26/2019 - 00:11

Magic method 

<?php

$referenced_entity_field_value = $node->field_entity_ref->entity->field_referenced_entity_field->first()->getValue();

 

 

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.