You are here

function hook_commerce_line_item_summary_link_info in Commerce Core 7

Defines links for use in line item summary area handlers on Views.

The line item summary area handler totals the value of the various line items in a View and optionally includes a set of links. These are used in the core shopping cart block View to let the user browse straight to the shopping cart form or the checkout form. The format of the return value is a links array as required by theme_links() with the addition of a weight parameter used to sort the links prior to display.

Return value

An associative array of link arrays keyed by link names, with the names being appended to the class of each link's list item when rendered by theme_links(). Link arrays should include the following key / value properties expected by theme_links():

  • title: the link text
  • href: the link URL; if ommitted, the link is rendered as plain text
  • html: boolean indicating whether or not the link text should be rendered as HTML or escaped; defaults to FALSE
  • weight: custom to this hook, the weight property is an integer value used to sort links prior to rendering; defaults to 0
  • access: custom to this hook, a boolean value indicating whether or not the current user has access to the link; defaults to TRUE

The full link array will be passed to theme_link(), meaning any additional properties can be included as desired (such as the attributes array as demonstrated below).

See also

commerce_line_item_summary_links()

commerce_cart_commerce_line_item_summary_link_info()

theme_links()

1 function implements hook_commerce_line_item_summary_link_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

commerce_cart_commerce_line_item_summary_link_info in modules/cart/commerce_cart.module
Implements hook_commerce_line_item_summary_link_info().
1 invocation of hook_commerce_line_item_summary_link_info()
commerce_line_item_summary_links in modules/line_item/commerce_line_item.module
Returns a sorted array of line item summary links.

File

modules/line_item/commerce_line_item.api.php, line 130
Hooks provided by the Line Item module.

Code

function hook_commerce_line_item_summary_link_info() {
  return array(
    'view_cart' => array(
      'title' => t('View cart'),
      'href' => 'cart',
      'attributes' => array(
        'rel' => 'nofollow',
      ),
      'weight' => 0,
    ),
    'checkout' => array(
      'title' => t('Checkout'),
      'href' => 'checkout',
      'attributes' => array(
        'rel' => 'nofollow',
      ),
      'weight' => 5,
      'access' => user_access('access checkout'),
    ),
  );
}