You are here

function commerce_addressbook_retrieve_view in Commerce Addressbook 7.2

Same name and namespace in other branches
  1. 7.3 commerce_addressbook.module \commerce_addressbook_retrieve_view()

Retrieve a View.

Parameters

$view_key: The ID of the View to embed.

$display_id: The ID of the display of the View.

$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 views object, you'll have to call render if to render it.

2 calls to commerce_addressbook_retrieve_view()
commerce_addressbook_profile_options_default in includes/commerce_addressbook.user.inc
Page callback for setting a customer profile as default. Used for both ajax and non-ajax delivery of the customer profile updates.
commerce_addressbook_profile_page in includes/commerce_addressbook.user.inc
Page callback for listing customer profiles of a certain type.

File

./commerce_addressbook.module, line 614
Defines addressbook functionality for customer profiles, allowing them to be reused and managed on a per-user basis.

Code

function commerce_addressbook_retrieve_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 view.
  return $view;
}