You are here

function commerce_embed_view in Commerce Core 7

Renders a View for display in some other element.

Parameters

$view_key: The ID of the View to embed.

$display_id: The ID of the display of the View that will actually be rendered.

$arguments: An array of arguments to pass to the View.

$override_url: A url that overrides the url of the current view.

Return value

The rendered output of the chosen View display.

7 calls to commerce_embed_view()
commerce_cart_add_to_cart_views_form_refresh in modules/cart/commerce_cart.module
Ajax callback: returns AJAX commands when an attribute widget is changed on the Views powered shopping cart form.
commerce_cart_block_view in modules/cart/commerce_cart.module
Implements hook_block_view().
commerce_cart_contents_pane_checkout_form in modules/cart/includes/commerce_cart.checkout_pane.inc
Checkout pane callback: returns the cart contents View for inclusion in the checkout form.
commerce_cart_contents_pane_review in modules/cart/includes/commerce_cart.checkout_pane.inc
Checkout pane callback: returns the cart contents review data for the Review checkout pane.
commerce_cart_view in modules/cart/includes/commerce_cart.pages.inc
Displays the shopping cart form and associated information.

... See full list

File

./commerce.module, line 355
Defines features and functions common to the Commerce modules.

Code

function commerce_embed_view($view_id, $display_id, $arguments, $override_url = '') {

  // Load the specified View.
  $view = views_get_view($view_id);
  $view
    ->set_display($display_id);

  // Set the specific arguments passed in.
  $view
    ->set_arguments($arguments);

  // Override the view url, if an override was provided.
  if (!empty($override_url)) {
    $view->override_url = $override_url;
  }

  // Prepare and execute the View query.
  $view
    ->pre_execute();
  $view
    ->execute();

  // Return the rendered View.
  return $view
    ->render();
}