You are here

protected function RestfulEntityViewMode::getEntityRenderElement in RESTful 7

Generate the render element from the entity and view mode.

Parameters

\EntityDrupalWrapper $wrapper: The entity wrapper.

string $view_mode: The view mode to use.

Return value

array A render array for the current entity.

1 call to RestfulEntityViewMode::getEntityRenderElement()
RestfulEntityViewMode::renderField in includes/RestfulEntityViewMode.php
Helper function to get the rendered field for the output.

File

includes/RestfulEntityViewMode.php, line 142
Contains \RestfulEntityViewMode

Class

RestfulEntityViewMode
@file Contains \RestfulEntityViewMode

Code

protected function getEntityRenderElement(\EntityDrupalWrapper $wrapper, $view_mode) {
  $entity_id = $wrapper
    ->getIdentifier();
  if (empty($this->renders[$view_mode][$entity_id])) {
    $render_element = $wrapper
      ->view($view_mode);
    $this->renders[$view_mode][$entity_id] = $render_element[$this->entityType][$entity_id];
  }
  return $this->renders[$view_mode][$entity_id];
}