Skip to content
Snippets Groups Projects
Commit 9340c340 authored by Jonathan Sacksick's avatar Jonathan Sacksick Committed by Ryan Szrama
Browse files

Issue #1348514 by jsacksick: rekey entities by ID in our controller's view...

Issue #1348514 by jsacksick: rekey entities by ID in our controller's view method before doing any additional processing on them.
parent b2ed2060
No related branches found
No related tags found
No related merge requests found
......@@ -317,6 +317,21 @@ class DrupalCommerceEntityController extends DrupalDefaultEntityController imple
* The renderable array.
*/
public function view($entities, $view_mode = '', $langcode = NULL, $page = NULL) {
// Create a new entities array keyed by entity ID.
$rekeyed_entities = array();
foreach ($entities as $key => $entity) {
// Use the entity's ID if available and fallback to its existing key value
// if we couldn't determine it.
if (isset($entity->{$this->idKey})) {
$key = $entity->{$this->idKey};
}
$rekeyed_entities[$key] = $entity;
}
$entities = $rekeyed_entities;
// If no view mode is specified, use the first one available..
if (!isset($this->entityInfo['view modes'][$view_mode])) {
reset($this->entityInfo['view modes']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment