You are here

function fb_app_view in Drupal for Facebook 5

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

File

./fb_app.module, line 214
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);

  // Perhaps this info should be hidden, unless user can edit node.
  if (user_access('administer fb apps')) {
    $node->content['fb_app'] = array(
      '#value' => theme('fb_app', $node->fb_app),
      '#weight' => 1,
    );
    if (count($node->fb_app_blocks)) {
      foreach ($node->fb_app_blocks as $delta => $data) {
        $node->content['fb_app_blocks'][$delta] = array(
          'subject' => array(
            '#value' => t('Block %num', array(
              '%num' => $delta + 1,
            )),
          ),
          'content' => array(
            '#value' => check_markup($data->body, $data->format, FALSE),
            '#weight' => 1,
          ),
        );
      }
    }
    $node->content['fb_app_blocks']['#weight'] = 10;
  }
  return $node;
}