You are here

function commerce_wishlist_block_view in Commerce Wishlist 7.2

Same name and namespace in other branches
  1. 7.3 commerce_wishlist.module \commerce_wishlist_block_view()

Implements hook_block_view().

File

./commerce_wishlist.module, line 287
Provides the wishlist for use in Drupal Commerce.

Code

function commerce_wishlist_block_view($delta = '') {
  global $user;
  $block = array();
  switch ($delta) {
    case 'share':
      $user_id = arg(0) == 'user' && arg(1) ? arg(1) : FALSE;

      // @todo: Provide a better way of performing access checks like these.
      if ($user_id && $user_id == $user->uid && user_access('manage own wishlist')) {
        $block['subject'] = t('Share My Wishlist');
        $block['content'] = array(
          '#theme' => 'commerce_wishlist_share_wishlist',
          '#account' => $user,
        );
      }
      break;
  }
  return $block;
}