You are here

public function EntityAPIControllerExportable::view in Entity API 7

Implements EntityAPIControllerInterface.

Overrides EntityAPIController::view

File

includes/entity.controller.inc, line 975
Provides a controller building upon the core controller but providing more features like full CRUD functionality.

Class

EntityAPIControllerExportable
A controller implementing exportables stored in the database.

Code

public function view($entities, $view_mode = 'full', $langcode = NULL, $page = NULL) {
  $view = parent::view($entities, $view_mode, $langcode, $page);
  if ($this->nameKey != $this->idKey) {

    // Re-key the view array to be keyed by name.
    $return = array();
    foreach ($view[$this->entityType] as $id => $content) {
      $key = isset($content['#entity']->{$this->nameKey}) ? $content['#entity']->{$this->nameKey} : NULL;
      $return[$this->entityType][$key] = $content;
    }
    $view = $return;
  }
  return $view;
}