How to get the entity id of a field collection that is displayed with a formatter on a node. Normally i would use entity api like this:
$entity_id = entity_id($entity_type, $build['#' . $entity_type]);

Comments

Caseledde’s picture

Status: Active » Fixed

For field_collections the array key is '#entity'.

$entity_id = entity_id($entity_type, $build['#$entity']);

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.