You are here

function fb_tab_admin_form_alter in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 7.3 fb_tab.admin.inc \fb_tab_admin_form_alter()

See fb_tab_form_alter.

1 call to fb_tab_admin_form_alter()
fb_tab_form_alter in ./fb_tab.module
Implements fb_tab_form_alter.

File

./fb_tab.admin.inc, line 87
Drupal administration of fb_tab.module.

Code

function fb_tab_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'];
    $config = _fb_tab_get_app_config($fb_app);
    $form['fb_app_data']['fb_tab'] = array(
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => isset($fb_app->label),
      '#title' => t('Facebook profile tabs'),
      '#description' => t('Settings which apply to <a href=!url target=_blank>profile tabs</a>.', array(
        '!url' => 'http://developers.facebook.com/docs/guides/canvas/#tabs',
      )),
    );

    // Override themes
    $themes = system_theme_data();
    ksort($themes);
    $theme_options[0] = t('System default');
    foreach ($themes as $theme) {
      if ($theme->status) {

        // Only enabled themes.
        $theme_options[$theme->name] = $theme->name;
      }
    }
    $form['fb_app_data']['fb_tab']['custom_theme'] = array(
      '#type' => 'select',
      '#title' => t('Theme for profile tabs'),
      '#description' => t('Choose a theme designed to return FBML specifically for the 520 pixel wide space allocated to tabs.  <br/>Note that if your tab path is a menu callback which returns FBML, this setting is ignored.'),
      '#options' => $theme_options,
      '#required' => TRUE,
      '#default_value' => $config['custom_theme'],
    );

    // Properties: http://developers.facebook.com/docs/appproperties
    $form['fb_app_data']['fb_tab']['tab_default_name'] = array(
      '#type' => 'textfield',
      '#title' => 'Tab name',
      '#default_value' => $config['tab_default_name'],
      '#description' => t('A very short title.'),
    );
    $form['fb_app_data']['fb_tab']['profile_tab_url'] = array(
      '#type' => 'textfield',
      '#title' => 'View path',
      '#default_value' => $config['profile_tab_url'],
      '#description' => t('Specify a Drupal page (i.e. "node/123") to render specific content in your page tab.  Or leave blank and implement <em>hook_fb_tab()</em> in your custom module.'),
    );
    $form['fb_app_data']['fb_tab']['profile_tab_url_liked'] = array(
      '#type' => 'textfield',
      '#title' => 'View path when page is liked',
      '#default_value' => $config['profile_tab_url_liked'],
      '#description' => t('Optionally specify another path when the user has liked the page where the tab is shown.  Leave blank to use <em>view path</em>.'),
    );
    $form['fb_app_data']['fb_tab']['edit_url'] = array(
      '#type' => 'textfield',
      '#title' => 'Edit path',
      '#default_value' => $config['edit_url'],
      '#description' => t('Recommended value is %edit_url.  Implement <em>hook_fb_tab()</em> to customize the configuration form.', array(
        '%edit_url' => FB_TAB_PATH_FORM,
      )),
    );
  }
}