You are here

public function EntityLegalDocumentController::view in Entity Legal 7

Same name and namespace in other branches
  1. 7.2 entity_legal.entity_controller.inc \EntityLegalDocumentController::view()

Override the document view to instead output the version view.

Overrides EntityAPIControllerExportable::view

File

./entity_legal.entity_controller.inc, line 110
Entity API controller classes for entity_legal module.

Class

EntityLegalDocumentController
Entity Legal Document controller class.

Code

public function view($entities, $view_mode = 'full', $langcode = NULL, $page = NULL) {
  $entities = entity_key_array_by_property($entities, $this->idKey);
  $view = array();
  foreach ($entities as $entity) {
    $published_version = $entity
      ->getPublishedVersion();
    if ($published_version) {
      $key = isset($entity->{$this->idKey}) ? $entity->{$this->idKey} : NULL;
      $view[$this->entityType][$key] = $published_version
        ->view('full', NULL, TRUE);
    }
  }
  return $view;
}