You are here

function feedback_view in Feedback 7.2

Generate a render array for viewing a feedback entry.

@todo This is an API function; move into feedback.module.

Parameters

$entry: A feedback entry object.

$view_mode: View mode, e.g. 'full', 'teaser'...

$langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.

Return value

An array as expected by drupal_render().

1 string reference to 'feedback_view'
feedback_menu in ./feedback.module
Implements hook_menu().

File

./feedback.admin.inc, line 329
Administrative functionality for Feedback module.

Code

function feedback_view($entry, $view_mode = 'full', $langcode = NULL) {
  if (!isset($langcode)) {
    $langcode = $GLOBALS['language_content']->language;
  }

  // Populate $entry->content with a render() array.
  feedback_build_content($entry, $view_mode, $langcode);
  $build = $entry->content;
  unset($entry->content);
  $build += array(
    '#theme' => 'feedback_entry',
    '#feedback' => $entry,
    '#view_mode' => $view_mode,
    '#language' => $langcode,
  );

  // Allow modules to modify the structured entry.
  $type = 'feedback';
  drupal_alter(array(
    'feedback_view',
    'entity_view',
  ), $build, $type);
  return $build;
}