You are here

function basic_cart_add_to_cart_link in Basic cart 7.2

Function returns an array to render add to cart link

1 call to basic_cart_add_to_cart_link()
basic_cart_handler_field_addtocart::render in views/basic_cart_handler_field_addtocart.inc
Overrides views_handler_field::render().

File

./basic_cart.theme.inc, line 31

Code

function basic_cart_add_to_cart_link($nid) {
  $link = array(
    '#type' => 'link',
    '#id' => drupal_html_id('basic-cart-add-to-cart-link-' . $nid),
    '#prefix' => '<div class="basic-cart-add-to-cart">',
    '#suffix' => '</div>',
    '#title' => t('Add to cart'),
    '#href' => 'cart/add/' . $nid,
    '#attributes' => array(
      'class' => array(
        'button',
        'basic-cart-add-to-cart-link',
      ),
    ),
  );
  return $link;
}