You are here

function fb_canvas_form_alter in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 5.2 fb_canvas.module \fb_canvas_form_alter()
  2. 5 fb_canvas.module \fb_canvas_form_alter()
  3. 6.2 fb_canvas.module \fb_canvas_form_alter()
  4. 7.3 fb_canvas.module \fb_canvas_form_alter()

Implementation of hook_form_alter.

File

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

Code

function fb_canvas_form_alter(&$form, &$form_state, $form_id) {
  if (isset($form['fb_app_data']) && is_array($form['fb_app_data'])) {

    // Add our settings to the fb_app edit form.

    //require 'fb_canvas.admin.inc';
    fb_canvas_admin_form_alter($form, $form_state, $form_id);
  }
  if (!empty($_REQUEST['signed_request']) && empty($form['signed_request']) && fb_is_canvas()) {

    // Facebook will pass our canvas pages the important signed_request.
    // When we submit a form, that data will be lost unless we explicitly include it in the form.
    $form['signed_request'] = array(
      '#type' => 'hidden',
      '#value' => $_REQUEST['signed_request'],
    );
  }
}