You are here

function redhen_org_menu in RedHen CRM 7

Implements hook_menu().

File

modules/redhen_org/redhen_org.module, line 110

Code

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

  // Add a org.
  $items['redhen/org'] = array(
    'title' => 'Organizations',
    'description' => 'View RedHen CRM Organizations.',
    'page callback' => 'redhen_org_page',
    'file' => 'includes/redhen_org.pages.inc',
    'access callback' => 'redhen_org_page_access',
  );

  // Add a org.
  $items['redhen/org/add'] = array(
    'title' => 'Add an organization',
    'description' => 'Add a new organization.',
    'page callback' => 'redhen_org_types_list_page',
    'access callback' => 'redhen_org_access',
    'access arguments' => array(
      'create',
    ),
    'file' => 'includes/redhen_org.pages.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  $entity_info = entity_get_info('redhen_org');
  foreach ($entity_info['bundles'] as $key => $bundle) {
    $items['redhen/org/add/' . $key] = array(
      'title' => $bundle['label'],
      'title callback' => 'check_plain',
      'description' => isset($bundle['description']) ? $bundle['description'] : '',
      'page callback' => 'redhen_org_add_page',
      'page arguments' => array(
        $key,
      ),
      'access callback' => 'redhen_org_access',
      'access arguments' => array(
        'create',
        $key,
      ),
      'file' => 'includes/redhen_org.pages.inc',
    );
  }
  $items['redhen/org/%redhen_org'] = array(
    'title callback' => 'redhen_org_org_title',
    'title arguments' => array(
      2,
    ),
    'page callback' => 'redhen_org_view',
    'page arguments' => array(
      2,
    ),
    'access callback' => 'redhen_org_access',
    'access arguments' => array(
      'view',
      2,
    ),
  );
  $items['redhen/org/%redhen_org/view'] = array(
    'title' => 'Summary',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -20,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
  );
  $items['redhen/org/%redhen_org/view/view'] = array(
    'title' => 'View',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 1,
  );
  $items['redhen/org/%redhen_org/view/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_org_org_form',
      2,
    ),
    'access callback' => 'redhen_org_access',
    'access arguments' => array(
      'edit',
      2,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
  );
  $items['redhen/org/%redhen_org/view/delete'] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_org_org_delete_form',
      2,
    ),
    'access callback' => 'redhen_org_access',
    'access arguments' => array(
      'delete',
      2,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 3,
  );
  $items['redhen/org/%redhen_org/view/archive'] = array(
    'title' => 'Archive',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_org_org_archive_form',
      2,
    ),
    'access callback' => 'redhen_org_access',
    'access arguments' => array(
      'archive',
      2,
    ),
    'type' => MENU_LOCAL_TASK,
  );
  $items['redhen/org/%redhen_org/view/unarchive'] = array(
    'title' => 'Unarchive',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_org_org_unarchive_form',
      2,
    ),
    'access callback' => 'redhen_org_access',
    'access arguments' => array(
      'unarchive',
      2,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 4,
  );
  $items['redhen/org/%redhen_org/revisions'] = array(
    'title' => 'Revisions',
    'type' => MENU_LOCAL_TASK,
    'page callback' => 'redhen_org_revision_list',
    'page arguments' => array(
      2,
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access redhen org revisions',
    ),
    'file' => 'includes/redhen_org.pages.inc',
    'weight' => 4,
  );
  $items['redhen/org/%redhen_org/revisions/%redhen_org_revision'] = array(
    'title callback' => 'redhen_org_org_title',
    'title arguments' => array(
      4,
    ),
    'page callback' => 'redhen_org_view',
    'page arguments' => array(
      4,
    ),
    'access callback' => 'redhen_org_access',
    'access arguments' => array(
      'view',
      4,
    ),
  );
  $items['redhen/org/%redhen_org/revisions/%redhen_org_revision/view'] = array(
    'title' => 'Summary',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
  );
  $items['redhen/org/%redhen_org/revisions/%redhen_org_revision/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_org_org_form',
      4,
    ),
    'access callback' => 'redhen_org_access',
    'access arguments' => array(
      'edit',
      4,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
  );
  $items['redhen/org/%redhen_org/revisions/%redhen_org_revision/delete'] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_org_org_delete_form',
      4,
    ),
    'access callback' => 'redhen_org_access',
    'access arguments' => array(
      'delete',
      4,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 10,
  );
  $items['redhen/org/%redhen_org/primary/%redhen_contact'] = array(
    'title callback' => 'Change primary contact',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redhen_org_set_primary_form',
      2,
      4,
    ),
    'access callback' => 'redhen_org_access',
    'access arguments' => array(
      'edit',
      2,
    ),
    'type' => MENU_CALLBACK,
  );
  $items['redhen/org/autocomplete'] = array(
    'title' => 'Autocomplete for RedHen Organizations',
    'page callback' => '_redhen_org_autocomplete',
    'access callback' => 'redhen_org_access',
    // TODO: Or whatever permission makes sense.
    'access arguments' => array(
      'edit',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'includes/redhen_org.pages.inc',
  );
  if (module_exists('devel')) {
    $items['redhen/org/%redhen_org/devel'] = array(
      'title' => 'Devel',
      'page callback' => 'redhen_devel_load_object',
      'page arguments' => array(
        'redhen_org',
        2,
      ),
      'access arguments' => array(
        'access devel information',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 100,
    );
    $items['redhen/org/%redhen_org/devel/load'] = array(
      'title' => 'Load',
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items['redhen/org/%redhen_org/devel/render'] = array(
      'title' => 'Render',
      'page callback' => 'redhen_devel_render_object',
      'page arguments' => array(
        'redhen_org',
        2,
      ),
      'access arguments' => array(
        'access devel information',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 100,
    );
  }
  return $items;
}