You are here

function fb_friend_invite_page_fbml in Drupal for Facebook 6.2

Same name and namespace in other branches
  1. 6.3 contrib/fb_friend.module \fb_friend_invite_page_fbml()
  2. 7.3 contrib/fb_friend.module \fb_friend_invite_page_fbml()
1 call to fb_friend_invite_page_fbml()
fb_friend_block in contrib/fb_friend.module
Implementation of hook_block().

File

contrib/fb_friend.module, line 165
This module implements several features specific to Facebook friend networks.

Code

function fb_friend_invite_page_fbml($alter_hook = NULL) {
  $page_url = url($_GET['q'], array(
    'absolute' => TRUE,
  ));

  // Build the alterable data structure.
  // http://wiki.developers.facebook.com/index.php/Fb:request-form
  $fbml = fb_form_requestform(array(
    'type' => variable_get('site_name', t('page view')),
    //'style' => "width: 500px;",
    'content' => array(
      'markup' => array(
        '#value' => t('You may want to see this. <a href="!url">!title</a>', array(
          '!url' => $page_url,
          '!title' => drupal_get_title(),
        )),
      ),
      'choice' => array(
        '#type' => 'fb_form_req_choice',
        '#attributes' => array(
          'url' => $page_url,
          'label' => t('Accept'),
        ),
      ),
    ),
    'invite' => TRUE,
    'action' => $page_url,
    'method' => 'POST',
  ));
  $fbml['selector'] = fb_form_multi_selector(array(
    'actiontext' => t('Invite friends'),
  ));

  // Allow third-party to modify the form
  if (isset($alter_hook)) {
    drupal_alter($alter_hook, $fbml);
  }
  if ($fbml) {
    if (fb_is_fbml_canvas()) {
      $xfbml = array(
        'fbml' => $fbml,
      );
    }
    else {

      // Render in Facebook Connect page.
      fb_connect_require_feature('XFBML');

      // Wrap in serverfbml for connect pages.
      $xfbml = array(
        '#type' => 'fb_form_serverfbml',
        'fbml' => $fbml,
      );
    }

    // Allow third-party to modify wrapper
    if (isset($alter_hook)) {
      drupal_alter($alter_hook . '_wrap', $xfbml);
    }
    return $xfbml;
  }
}