You are here

function fb_canvas_form_action_via_facebook in Drupal for Facebook 6.2

Same name and namespace in other branches
  1. 5.2 fb_canvas.module \fb_canvas_form_action_via_facebook()

Call this from your form_alter hook to prevent changes to the form's default action.

1 call to fb_canvas_form_action_via_facebook()
fb_canvas_form_alter in ./fb_canvas.module
Implementation of hook_form_alter.

File

./fb_canvas.module, line 424
This module provides support for Canvas page applications. Use Drupal to power traditional Facebook Apps.

Code

function fb_canvas_form_action_via_facebook(&$form, $use_facebook = TRUE) {
  if (isset($form[FB_CANVAS_FORM_HANDLER_WRAP])) {
    if ($use_facebook) {
      $form['#action'] = $form[FB_CANVAS_FORM_HANDLER_WRAP]['#action_fb'];
      $form[FB_CANVAS_FORM_HANDLER_WRAP][FB_CANVAS_FORM_HANDLER_ENABLED] = array(
        '#value' => FALSE,
        '#type' => 'hidden',
      );
    }
    else {
      $form['#action'] = $form[FB_CANVAS_FORM_HANDLER_WRAP]['#action_local'];
      $form[FB_CANVAS_FORM_HANDLER_WRAP][FB_CANVAS_FORM_HANDLER_ENABLED] = array(
        '#value' => TRUE,
        '#type' => 'hidden',
      );
    }
  }
}