I have a field collection nested inside a node. That field collection has a field collection nested inside it. That field collections has other field collections nested inside it. When I go to one of the nested field collection entities (view or edit) I want a breadcrumb trail to show a path back up the chain to the node. Is there anything existing like that out there?

Comments

RobKoberg’s picture

Category: support » feature

Hi again, Perhaps the following would be a useful function to add to the field_collection module (unless it already exists and I missed it?):

function field_collection_get_entity_ancestors($entity, &$ancestor_array) {
  if (method_exists($entity, 'hostEntity') && $ancestor = $entity->hostEntity()) {
    $ancestor_array[] = $ancestor;
    field_collection_get_entity_ancestors($ancestor, $ancestor_array);
  }
}

Or perhaps there is a better performing way to recurse up or get the ancestry chain?

jmuzz’s picture

Issue summary: View changes
Status: Active » Fixed

The common approach would be to implement hook_menu_breadcrumb_alter.

I'm not sure I see the point of traversing the ancestor trail to put it in an array. In this case the array is going to be looped over to build the breadcrumbs and the breadcrumbs can be built while traversing the trail instead.

Status: Fixed » Closed (fixed)

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

osopolar’s picture

Status: Closed (fixed) » Active

Breadcrumbs aren't working yet, instead there is a comment in field_collection_item_page_view():

@todo: Set breadcrumb including the host.