It seems that a node with a Field Collection makes some trouble.

Notice: Undefined index: #field_collection_item in display_cache_entity_view_alter() (line 173 of /mnt/www/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/TEST/sites/all/modules/custom/display_cache/display_cache.module).

Comments

marcoka’s picture

Caseledde’s picture

Status: Active » Needs review

Thank you for your bug report. The array key for a field collection is '#entiy'. It seems that all entities based on the Entity API module used that key.

To play it safe, I build the following construction:

<?php
if (!empty($build['#' . $entity_type])) {
  $entity_id = entity_id($entity_type, $build['#' . $entity_type]);
}
else if (!empty($build['#entity'])) {
  $entity_id = entity_id($entity_type, $build['#entity']);
}
else {
  watchdog('display cache', 'The entity type <em>@entity_type</em> seems to be unsupported until now. Please report this to the issue cue of Display Cache so we can fix this.', array('@entity_type' => $entity_type), WATCHDOG_WARNING);
  return;
}
?>
Caseledde’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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