You are here

function fb_admin_app_page in Drupal for Facebook 6.2

Same name and namespace in other branches
  1. 6.3 fb.admin.inc \fb_admin_app_page()
  2. 7.3 fb.admin.inc \fb_admin_app_page()
1 string reference to 'fb_admin_app_page'
fb_menu in ./fb.module
Implementation of hook_menu().

File

./fb.admin.inc, line 92
Admin pages and forms for Drupal for Facebook.

Code

function fb_admin_app_page($fb_app = NULL) {
  fb_get_app_data($fb_app);
  fb_admin_get_app_properties($fb_app);

  // Hide these, show secret only on form.
  unset($fb_app->secret);
  unset($fb_app->data);

  // Warn user if values have changed since last edit.
  foreach (array(
    'canvas_name' => 'canvas',
    'application_name' => 'title',
  ) as $prop => $key) {
    if (isset($fb_app->{$prop}) && $fb_app->{$prop} != $fb_app->{$key}) {
      drupal_set_message(t("The property %prop has been changed to %value on facebook.  Go to the Edit tab, confirm values are correct and hit Save button to syncronize the local values.", array(
        '%prop' => $prop,
        '%value' => $fb_app->{$prop},
      )), 'error');
    }
  }
  $props_map = array(
    t('Label') => 'label',
    t('API Key') => 'apikey',
    t('ID') => 'id',
  );
  $output = "<dl>\n";
  $props_map = fb_invoke(FB_ADMIN_OP_LIST_PROPERTIES, array(
    'fb_app' => $fb_app,
  ), $props_map, FB_ADMIN_HOOK);
  foreach ($props_map as $name => $key) {
    if (isset($fb_app->{$key})) {
      $output .= "<dt>{$name}</dt><dd>{$fb_app->{$key}}</dd>\n";
    }
  }
  $output .= "</dl>\n";

  //$output .=  '<pre>' . print_r($fb_app, 1) . '</pre>'; // debug
  return $output;
}