You are here

function fb_form_request_form in Drupal for Facebook 5.2

Same name and namespace in other branches
  1. 5 fb_form.module \fb_form_request_form()
  2. 6.2 fb_form.module \fb_form_request_form()

Helper function to produce a request or invite form. Note that this does not produce a full form (i.e. never use drupal_get_form('fb_form_request_form')). The caller is expected to fill out the rest of the form before returning it for use with drupal_get_form.

File

./fb_form.module, line 200
This module defines facebook-specific form elements for use with Drupal's form API.

Code

function fb_form_request_form($config = array()) {
  global $fb, $fb_app;

  // only works on canvas pages.
  // Default config
  $config = array_merge(array(
    'type' => $fb_app->title,
    'content' => 'INVITE CONTENT XXX',
    'action' => 'http://apps.facebook.com/' . $fb_app->canvas,
    'invite' => 'true',
    'method' => 'POST',
  ), $config);

  // form type fb:request-form
  $form = array(
    '#fb_form_type_hack' => 'fb_form_request',
    /* becomes #type during form_alter */
    '#attributes' => array(
      'type' => $config['type'],
      'content' => htmlentities($config['content']),
      'invite' => $config['invite'],
    ),
    '#action' => $config['action'],
  );

  // Caller must add fb:multi-friend-selector or some other selector.
  return $form;
}