You are here

function fb_app_view in Drupal for Facebook 5.2

Same name and namespace in other branches
  1. 5 fb_app.module \fb_app_view()

File

./fb_app.module, line 228
Defines a custom node type that stores a facebook application configuration.

Code

function fb_app_view($node, $teaser = FALSE, $page = FALSE) {
  $node = node_prepare($node, $teaser);
  $fb_app = (object) $node->fb_app;

  // cast in case of preview
  fb_app_get_app_properties($fb_app);

  // Perhaps this info should be hidden, unless user can edit node.
  if (user_access('administer fb apps')) {
    if ($fb_app->edit_url) {
      $node->content['edit_link'] = array(
        '#value' => '<p>' . t('<a href="!url">Edit this application</a> on Facebook.', array(
          '!url' => $fb_app->edit_url,
        )) . '</p>',
        '#type' => 'markup',
      );
    }
    $node->content['fb_app'] = array(
      '#value' => theme('fb_app', $fb_app),
      '#weight' => 1,
    );
  }
  return $node;
}