You are here

function redhen_contact_menu in RedHen CRM 7

Implements hook_menu().

File

modules/redhen_contact/redhen_contact.module, line 145
Module file for RedHen contacts.

Code

function redhen_contact_menu() {
  $items = array();

  // Add a contact.
  $items['redhen/contact'] = array(
    'title' => 'Contacts',
    'description' => 'View RedHen CRM contacts.',
    'page callback' => 'redhen_contact_page',
    'file' => 'includes/redhen_contact.pages.inc',
    'access arguments' => array(
      'access redhen contacts',
    ),
  );

  // Add a contact.
  $items['redhen/contact/add'] = array(
    'title' => 'Add a contact',
    'description' => 'Add a new contact.',
    'page callback' => 'redhen_contact_types_list_page',
    'access callback' => 'redhen_contact_access',
    'access arguments' => array(
      'create',
    ),
    'file' => 'includes/redhen_contact.pages.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  $entity_info = entity_get_info('redhen_contact');
  foreach ($entity_info['bundles'] as $key => $bundle) {
    $items['redhen/contact/add/' . $key] = array(
      'title' => $bundle['label'],
      'title callback' => 'check_plain',
      'description' => isset($bundle['description']) ? $bundle['description'] : '',
      'page callback' => 'redhen_contact_add_page',
      'page arguments' => array(
        $key,
      ),
      'access callback' => 'redhen_contact_access',
      'access arguments' => array(
        'create',
      ),
      'file' => 'includes/redhen_contact.pages.inc',
    );
  }
  $items['redhen/contact/%redhen_contact'] = array(
    'title callback' => 'redhen_contact_contact_title',
    'title arguments' => array(
      2,
    ),
    'page callback' => 'redhen_contact_view',
    'page arguments' => array(
      2,
    ),
    'access callback' => 'redhen_contact_access',
    'access arguments' => array(
      'view',
      2,
    ),
    'weight' => 10,
  );
  $items['redhen/contact/%redhen_contact/view'] = array(
    'title' => 'Summary',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
  );
  $items['redhen/contact/%redhen_contact/view/view'] = array(
    'title' => 'View',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 1,
  );
  $items['redhen/contact/%redhen_contact/view/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_contact_contact_form',
      2,
    ),
    'access callback' => 'redhen_contact_access',
    'access arguments' => array(
      'edit',
      2,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/redhen_contact.forms.inc',
    'weight' => 2,
  );
  $items['redhen/contact/%redhen_contact/view/user'] = array(
    'title' => 'Drupal user',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_contact_contact_user_form',
      2,
    ),
    'access callback' => 'redhen_contact_access',
    'access arguments' => array(
      'edit',
      2,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/redhen_contact.forms.inc',
    'weight' => 3,
  );
  $items['redhen/contact/%redhen_contact/view/delete'] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_contact_contact_delete_form',
      2,
    ),
    'access callback' => 'redhen_contact_access',
    'access arguments' => array(
      'delete',
      2,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/redhen_contact.forms.inc',
    'weight' => 5,
  );
  $items['redhen/contact/%redhen_contact/view/archive'] = array(
    'title' => 'Archive',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_contact_contact_archive_form',
      2,
    ),
    'access callback' => 'redhen_contact_access',
    'access arguments' => array(
      'archive',
      2,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/redhen_contact.forms.inc',
    'weight' => 4,
  );
  $items['redhen/contact/%redhen_contact/revisions'] = array(
    'title' => 'Revisions',
    'type' => MENU_LOCAL_TASK,
    'page callback' => 'redhen_contact_revision_list',
    'page arguments' => array(
      2,
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'view redhen contact revisions',
    ),
    'file' => 'includes/redhen_contact.pages.inc',
    'weight' => 4,
  );
  $items['redhen/contact/%redhen_contact/revisions/%redhen_contact_revision'] = array(
    'title callback' => 'redhen_contact_contact_title',
    'title arguments' => array(
      4,
    ),
    'page callback' => 'redhen_contact_view',
    'page arguments' => array(
      4,
    ),
    'access callback' => 'redhen_contact_access',
    'access arguments' => array(
      'view',
      4,
    ),
  );
  $items['redhen/contact/%redhen_contact/revisions/%redhen_contact_revision/view'] = array(
    'title' => 'Summary',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
  );
  $items['redhen/contact/%redhen_contact/revisions/%redhen_contact_revision/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_contact_contact_form',
      4,
    ),
    'access callback' => 'redhen_contact_access',
    'access arguments' => array(
      'edit',
      4,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/redhen_contact.forms.inc',
    'weight' => 2,
  );
  $items['redhen/contact/%redhen_contact/revisions/%redhen_contact_revision/delete'] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_contact_contact_delete_form',
      4,
    ),
    'access callback' => 'redhen_contact_access',
    'access arguments' => array(
      'delete',
      4,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/redhen_contact.forms.inc',
    'weight' => 5,
  );
  $items['redhen/contact/%redhen_contact/view/unarchive'] = array(
    'title' => 'Unarchive',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_contact_contact_unarchive_form',
      2,
    ),
    'access callback' => 'redhen_contact_access',
    'access arguments' => array(
      'unarchive',
      2,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/redhen_contact.forms.inc',
    'weight' => 4,
  );
  if (!variable_get(REDHEN_CONTACT_EMBED_ON_USER_FORM, FALSE)) {
    $items['user/%user/redhen_contact'] = array(
      'title' => 'RedHen Contact',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'redhen_contact_user_contact_form',
        1,
      ),
      'access callback' => 'redhen_contact_user_contact_access',
      'access arguments' => array(
        1,
      ),
      'type' => MENU_LOCAL_TASK,
      'file' => 'includes/redhen_contact.forms.inc',
      'weight' => 5,
    );
  }
  if (module_exists('devel')) {
    $items['redhen/contact/%redhen_contact/devel'] = array(
      'title' => 'Devel',
      'page callback' => 'redhen_devel_load_object',
      'page arguments' => array(
        'redhen_contact',
        2,
      ),
      'access arguments' => array(
        'access devel information',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 100,
    );
    $items['redhen/contact/%redhen_contact/devel/load'] = array(
      'title' => 'Load',
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items['redhen/contact/%redhen_contact/devel/render'] = array(
      'title' => 'Render',
      'page callback' => 'redhen_devel_render_object',
      'page arguments' => array(
        'redhen_contact',
        2,
      ),
      'access arguments' => array(
        'access devel information',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 100,
    );
  }
  return $items;
}