You are here

function profile2_diff_menu in Profile 2 7.2

Implements hook_menu().

File

contrib/profile2_diff.module, line 31
Provides functionality to show a diff between two profile2 revisions.

Code

function profile2_diff_menu() {
  foreach (profile2_get_types() as $type_name => $type) {
    if (empty($type->data['use_page'])) {
      $items["user/%user/revisions/{$type_name}/diff"] = array(
        'title' => 'Compare revisions',
        'page callback' => 'profile2_diff_diffs_show_by_user',
        'page arguments' => array(
          $type_name,
          1,
          5,
          6,
        ),
        'type' => MENU_LOCAL_TASK,
        'access callback' => '_profile2_revision_tab_access',
        'access arguments' => array(
          $type_name,
          1,
          array(
            'view own profile revisions',
            'view any profile revisions',
          ),
        ),
        'file' => 'profile2_diff.pages.inc',
      );
      $items["user/%user/revisions/{$type_name}/latest"] = array(
        'title' => 'Show latest difference',
        'page callback' => 'profile2_diff_latest_by_user',
        'page arguments' => array(
          $type_name,
          1,
        ),
        'type' => MENU_CALLBACK,
        'access callback' => '_profile2_revision_tab_access',
        'access arguments' => array(
          $type_name,
          1,
          array(
            'view own profile revisions',
            'view any profile revisions',
          ),
        ),
        'file' => 'profile2_diff.pages.inc',
      );
    }
    else {
      $path = profile2_page_get_base_path($type);
      $count = count(explode('/', $path));
      $items[$path . '/%profile2_by_uid/revisions/ops/diff'] = array(
        'title' => 'Compare revisions',
        'page callback' => 'profile2_diff_diffs_show',
        'page arguments' => array(
          $count,
          $count + 4,
          $count + 5,
        ),
        'load arguments' => array(
          $type_name,
        ),
        'access callback' => '_profile2_revision_access',
        'access arguments' => array(
          $count,
          array(
            'view own profile revisions',
            'view any profile revisions',
          ),
        ),
        'type' => MENU_LOCAL_TASK,
        'file' => 'profile2_diff.pages.inc',
      );
      $items[$path . '/%profile2_by_uid/revisions/latest'] = array(
        'title' => 'Show latest difference',
        'page callback' => 'profile2_diff_latest',
        'page arguments' => array(
          $count,
        ),
        'load arguments' => array(
          $type_name,
        ),
        'access callback' => '_profile2_revision_access',
        'access arguments' => array(
          $count,
          array(
            'view own profile revisions',
            'view any profile revisions',
          ),
        ),
        'type' => MENU_CALLBACK,
        'file' => 'profile2_diff.pages.inc',
      );
    }
  }
  $items['admin/config/content/diff/entities/profile'] = array(
    'title' => 'Profiles',
    'description' => 'User profile diff settings.',
    'file' => 'diff.admin.inc',
    'file path' => drupal_get_path('module', 'diff'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'diff_admin_global_entity_settings',
      'profile2',
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'weight' => 1,
    'type' => MENU_LOCAL_TASK,
  );
  return $items;
}