function commerce_addressbook_menu in Commerce Addressbook 7.3
Same name and namespace in other branches
- 7 commerce_addressbook.module \commerce_addressbook_menu()
- 7.2 commerce_addressbook.module \commerce_addressbook_menu()
Implements hook_menu().
File
- ./
commerce_addressbook.module, line 36 - Defines addressbook functionality for customer profiles, allowing them to be reused and managed on a per-user basis.
Code
function commerce_addressbook_menu() {
$items = array();
$items['user/%user/addressbook'] = array(
'title' => 'Address Book',
'page callback' => 'commerce_addressbook_page',
'page arguments' => array(
1,
),
'access callback' => 'commerce_addressbook_page_access',
'access arguments' => array(
1,
),
'type' => MENU_LOCAL_TASK,
'file' => 'includes/commerce_addressbook.user.inc',
'weight' => 20,
);
// Custom administrative components for managing customer profile entities
// from the user pages.
foreach (commerce_customer_profile_types() as $type => $profile_type) {
$items['user/%user/addressbook/' . $type] = array(
'page callback' => 'commerce_addressbook_profile_page',
'page arguments' => array(
1,
$type,
),
'access callback' => 'commerce_addressbook_profile_page_access',
'access arguments' => array(
1,
$type,
),
'title' => $profile_type['name'],
'type' => MENU_LOCAL_TASK,
'file' => 'includes/commerce_addressbook.user.inc',
);
$items['user/%user/addressbook/' . $type . '/create'] = array(
'page callback' => 'commerce_addressbook_profile_create',
'page arguments' => array(
1,
$type,
),
'access callback' => 'commerce_addressbook_profile_create_access',
'access arguments' => array(
1,
$type,
),
'title' => 'Add an address',
'type' => MENU_LOCAL_ACTION,
'file' => 'includes/commerce_addressbook.user.inc',
);
$items['user/%user/addressbook/' . $type . '/edit/%commerce_customer_profile'] = array(
'title callback' => 'commerce_addressbook_profile_edit_title',
'title arguments' => array(
3,
),
'page callback' => 'commerce_addressbook_profile_options_edit',
'page arguments' => array(
1,
5,
),
'access callback' => 'commerce_customer_profile_access',
'access arguments' => array(
'update',
5,
),
'type' => MENU_CALLBACK,
'file' => 'includes/commerce_addressbook.user.inc',
);
$items['user/%user/addressbook/' . $type . '/default/%commerce_customer_profile'] = array(
'page callback' => 'commerce_addressbook_profile_options_default',
'page arguments' => array(
1,
5,
),
'access callback' => 'commerce_customer_profile_access',
'access arguments' => array(
'update',
5,
),
'type' => MENU_CALLBACK,
'file' => 'includes/commerce_addressbook.user.inc',
);
$items['user/%user/addressbook/' . $type . '/delete/%commerce_customer_profile'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'commerce_addressbook_profile_options_delete_form',
1,
5,
),
'access callback' => 'commerce_customer_profile_access',
'access arguments' => array(
'delete',
5,
),
'type' => MENU_CALLBACK,
'file' => 'includes/commerce_addressbook.user.inc',
);
}
return $items;
}