You are here

function commerce_message_order_summary in Commerce Message 7

Message callback; Show order summary.

Parameters

Message $message: The Message entity.

Return value

string The output of the View.

1 call to commerce_message_order_summary()
CommerceMessageOrderSummaryTest::testViewAsOrderOwner in ./commerce_message.test
1 string reference to 'commerce_message_order_summary'
commerce_message_message_presave in ./commerce_message.module
Implements hook_message_presave().

File

./commerce_message.module, line 82

Code

function commerce_message_order_summary(Message $message) {
  $wrapper = entity_metadata_wrapper('message', $message);
  $view = views_get_view('commerce_cart_summary');
  $view
    ->set_arguments(array(
    $wrapper->message_commerce_order
      ->getIdentifier(),
  ));
  $view->hide_admin_links = TRUE;

  // Disable SQL query rewrite so this renders properly for token.
  // @link https://www.drupal.org/node/1895418
  $view->display['default']->display_options['query']['options']['disable_sql_rewrite'] = TRUE;
  return $view
    ->preview();
}