You are here

function fb_canvas_admin_form_alter in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 6.3 fb_canvas.admin.inc \fb_canvas_admin_form_alter()

See fb_canvas_form_alter.

1 call to fb_canvas_admin_form_alter()
fb_canvas_form_alter in ./fb_canvas.module
Implements hook_form_alter.

File

./fb_canvas.admin.inc, line 74
Admin pages and forms for canvas apps.

Code

function fb_canvas_admin_form_alter(&$form, &$form_state, $form_id) {

  // Add our settings to the fb_app edit form.
  if (isset($form['fb_app_data']) && is_array($form['fb_app_data'])) {
    $fb_app = $form['#fb_app'];
    $fb_canvas_data = _fb_canvas_get_config($fb_app);
    $form['fb_app_data']['fb_canvas'] = array(
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => isset($fb_app->label),
      '#title' => t('Facebook canvas pages'),
      '#description' => t('Settings which apply to <a href=!url target=_blank>canvas pages</a>.', array(
        '!url' => 'http://developers.facebook.com/docs/guides/canvas/',
      )),
    );

    // Override themes. Start by fetching all enabled themes.
    $themes = system_get_info('theme');
    ksort($themes);
    $theme_options[0] = t('System default');
    foreach ($themes as $key => $theme) {
      $theme_options[$key] = $theme['name'];
    }
    $form['fb_app_data']['fb_canvas']['theme_iframe'] = array(
      '#type' => 'select',
      '#title' => t('Theme for canvas pages'),
      '#description' => t('Choose a theme designed for 760px width iframe canvas.'),
      '#options' => $theme_options,
      '#required' => TRUE,
      '#default_value' => isset($fb_canvas_data['theme_iframe']) ? $fb_canvas_data['theme_iframe'] : '',
    );
    if (FALSE) {

      // @TODO - no require_login in new libs???
      $form['fb_app_data']['fb_canvas']['require_login'] = array(
        '#type' => 'radios',
        '#title' => t('Require authorization'),
        '#description' => t('Require authorization if you want Drupal for Facebook to call require_login() on <strong>every</strong> canvas page.'),
        '#options' => array(
          FB_CANVAS_OPTION_ALLOW_ANON => t('Allow anonymous visitors'),
          FB_CANVAS_OPTION_REQUIRE_LOGIN => t('Require all users to authorize the application'),
        ),
        '#default_value' => $fb_canvas_data['require_login'],
        '#required' => TRUE,
      );
    }
    $form['fb_app_data']['fb_canvas']['front_anonymous'] = array(
      '#type' => 'textfield',
      '#title' => t('Front page when user has not authorized the application'),
      '#description' => t('This is the front page for users who are not logged into facebook, or have not authorized the application.  Leave blank to use the site-wide front page.'),
      '#default_value' => $fb_canvas_data['front_anonymous'],
    );
    $form['fb_app_data']['fb_canvas']['front_added'] = array(
      '#type' => 'textfield',
      '#title' => t('Front page for authorized users of this application'),
      '#description' => t('Leave blank to use the site-wide front page.'),
      '#default_value' => $fb_canvas_data['front_added'],
    );
  }
}