You are here

function fb_friend_invite_page_fbml in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 6.2 contrib/fb_friend.module \fb_friend_invite_page_fbml()
  2. 7.3 contrib/fb_friend.module \fb_friend_invite_page_fbml()

Deprecated

use fb_friend_request_content instead.

File

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

Code

function fb_friend_invite_page_fbml($alter_hook = NULL, $submit_path = NULL, $accept_path = NULL) {

  // Defaults
  if (!isset($submit_path)) {
    $submit_path = $_GET['q'];
  }
  if (!isset($accept_path)) {
    $accept_path = $_GET['q'];
  }
  $submit_url = url($submit_path, array(
    'absolute' => TRUE,
  ));
  $accept_url = url($accept_path, array(
    'absolute' => TRUE,
  ));

  // Build the alterable data structure.
  // http://developers.facebook.com/docs/reference/fbml/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' => $accept_url,
          '!title' => drupal_get_title(),
        )),
      ),
      'choice' => array(
        '#type' => 'fb_form_req_choice',
        '#attributes' => array(
          'url' => $accept_url,
          'label' => t('Accept'),
        ),
      ),
    ),
    'invite' => TRUE,
    'action' => $submit_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) {

    // Wrap in serverfbml.
    $xfbml = array(
      '#type' => 'fb_form_serverfbml',
      'fbml' => $fbml,
      '#prefix' => '<div class="fb-request-form">',
      '#suffix' => '</div>',
    );

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