You are here

function fb_connect_form_alter in Drupal for Facebook 5.2

Same name and namespace in other branches
  1. 6.3 fb_connect.module \fb_connect_form_alter()
  2. 6.2 fb_connect.module \fb_connect_form_alter()
  3. 7.3 fb_connect.module \fb_connect_form_alter()

File

./fb_connect.module, line 357
Support for Facebook Connect features

Code

function fb_connect_form_alter($form_id, &$form) {

  // Add our settings to the fb_app edit form.
  if (is_array($form['fb_app_data'])) {
    $node = $form['#node'];
    $fb_app_data = fb_app_get_data($node->fb_app);
    $fb_connect_data = $fb_app_data['fb_connect'];
    $form['fb_app_data']['fb_connect'] = array(
      '#type' => 'fieldset',
      '#title' => 'Facebook Connect',
      '#tree' => TRUE,
      '#collapsible' => TRUE,
      '#collapsed' => $node->nid ? TRUE : FALSE,
    );
    $form['fb_app_data']['fb_connect']['primary'] = array(
      '#type' => 'checkbox',
      '#title' => t('Primary'),
      '#description' => t('Initialize fbConnect javascript on all (non-canvas) pages.  If this site supports multiple Facebook Apps, this may be checked for at most one.'),
      '#default_value' => $fb_connect_data['primary'],
    );
    if ($primary_apikey = variable_get('fb_connect_primary_apikey', NULL)) {
      if ($primary_apikey != $node->fb_app->apikey) {
        $primary = fb_get_app(array(
          'apikey' => $primary_apikey,
        ));
        $form['fb_app_data']['fb_connect']['primary']['#description'] .= '<br/>' . t('Note that checking this will replace %app as the primary Facebook Connect app.', array(
          '%app' => $primary ? $primary->title : $primary_apikey,
        ));
      }
    }
  }
}