You are here

function fb_menu in Drupal for Facebook 7.4

Same name and namespace in other branches
  1. 5.2 fb.module \fb_menu()
  2. 5 fb.module \fb_menu()
  3. 6.3 fb.module \fb_menu()
  4. 6.2 fb.module \fb_menu()
  5. 7.3 fb.module \fb_menu()

Implements hook_menu().

File

./fb.module, line 152

Code

function fb_menu() {
  $items = array();
  $admin_item = array(
    'access arguments' => array(
      FB_PERM_ADMINISTER,
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'fb.admin.inc',
    'file path' => drupal_get_path('module', 'fb'),
  );

  //// Administration

  // Top level item copied from Drupal core modules.
  $items[FB_PATH_ADMIN_CONFIG] = array(
    'title' => 'Facebook',
    'description' => 'Connectivity to facebook.com.',
    //'position' => 'left',

    //'weight' => -20,
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'access administration pages',
    ),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items[FB_PATH_ADMIN_CONFIG . '/settings'] = array(
    'title' => 'Settings',
    'weight' => -20,
    'description' => 'Control how this site interacts with Facebook.com',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'fb_admin_settings_form',
    ),
  ) + $admin_item;

  // Settings page has tabs.
  $items[FB_PATH_ADMIN_CONFIG . '/settings/default'] = array(
    'title' => 'Facebook Settings',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -20,
  ) + $admin_item;
  $items[FB_PATH_ADMIN_CONFIG . '/settings/app'] = array(
    'title' => 'Application',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'fb_admin_default_app_form',
    ),
    'type' => MENU_LOCAL_TASK,
  ) + $admin_item;
  $items[FB_PATH_ADMIN_CONFIG . '/settings/token'] = array(
    'title' => 'Token',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'fb_admin_default_token_form',
    ),
    'type' => MENU_LOCAL_TASK,
  ) + $admin_item;

  // Page to administer all saved tokens.
  $items[FB_PATH_ADMIN_CONFIG . '/token'] = array(
    'title' => 'Access Tokens',
    'weight' => 20,
    'description' => 'Manage Facebook access tokens',
    'page callback' => 'fb_admin_token_page',
    'access arguments' => array(
      FB_PERM_ADMINISTER_TOKEN,
    ),
  ) + $admin_item;

  // Replace an expired token.
  $items[FB_PATH_ADMIN_CONFIG . '/token_replace'] = array(
    'title' => 'Replace Token',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'fb_admin_token_replace_form',
    ),
    'type' => MENU_CALLBACK,
  ) + $admin_item;

  // Administer all apps
  $items[FB_PATH_ADMIN_APPS] = array(
    'title' => 'Applications',
    'description' => 'Manage Facebook Apps.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'fb_admin_applications_form',
    ),
  ) + $admin_item;

  // Apps page has tabs.
  $items[FB_PATH_ADMIN_APPS . '/default'] = array(
    'title' => 'Applications',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -20,
  ) + $admin_item;
  $items[FB_PATH_ADMIN_APPS . '/add'] = array(
    'title' => 'Add Application',
    //'description' => 'Host an application on this server.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'fb_admin_application_edit_form',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 20,
  ) + $admin_item;

  // Admin pages for each app.
  $items[FB_PATH_ADMIN_APPS . '/%fb'] = array(
    'title' => 'Application Detail',
    'description' => 'Facebook Applications',
    'page callback' => 'fb_admin_app_page',
    'page arguments' => array(
      FB_PATH_ADMIN_APPS_ARGS,
    ),
    'access arguments' => array(
      FB_PERM_ADMINISTER,
    ),
    'file' => 'fb.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $items[FB_PATH_ADMIN_APPS . '/%fb/view'] = array(
    'title' => 'View',
    'weight' => -2,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items[FB_PATH_ADMIN_APPS . '/%fb/edit'] = array(
    'title' => 'Edit',
    'description' => 'Edit Facebook Application',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'fb_admin_application_edit_form',
      FB_PATH_ADMIN_APPS_ARGS,
    ),
    'access arguments' => array(
      FB_PERM_ADMINISTER,
    ),
    'file' => 'fb.admin.inc',
    'weight' => -1,
    'type' => MENU_LOCAL_TASK,
  );
  $items[FB_PATH_ADMIN_APPS . '/%fb/delete'] = array(
    'title' => 'Delete',
    'description' => 'Delete Facebook Application',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'fb_admin_application_delete_form',
      FB_PATH_ADMIN_APPS_ARGS,
    ),
    'access arguments' => array(
      FB_PERM_ADMINISTER,
    ),
    'file' => 'fb.admin.inc',
    'weight' => -1,
    'type' => MENU_NORMAL_ITEM,
  );

  // Allow a user to get a token.

  //XXXX
  $items['fb/token'] = array(
    'title' => 'Fb Token',
    'page callback' => 'fb_page_token',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );

  // Javascript event handler.
  $items[FB_PATH_AJAX_EVENT . '/%'] = array(
    'page callback' => 'fb_ajax_event',
    'type' => MENU_CALLBACK,
    'access callback' => TRUE,
    'page arguments' => array(
      FB_PATH_AJAX_EVENT_ARGS,
    ),
  );
  return $items;
}