Look up access_token for users not currently logged in
[project/fb.git] / fb_tab.admin.inc
CommitLineData
5441e7bd 1<?php
cd64a628
DC
2
3/**
4 * @file
5 * Drupal administration of fb_tab.module.
6 */
5441e7bd
DC
7
8/**
3cf45120 9 * Implements hook_fb_admin().
5441e7bd
DC
10 */
11function fb_tab_fb_admin($op, $data, &$return) {
12 $fb = isset($data['fb']) ? $data['fb'] : NULL;
13 $fb_app = isset($data['fb_app']) ? $data['fb_app'] : NULL;
14 $config = _fb_tab_get_config($fb_app);
15 if ($op == FB_ADMIN_OP_SET_PROPERTIES) {
16 $return['tab_default_name'] = $config['tab_default_name'];
17 $return['profile_tab_url'] = $config['profile_tab_url'];
d01ea23e 18 //$return['edit_url'] = $config['edit_url']; // Apparently not used by facebook.
5441e7bd
DC
19 }
20 elseif ($op == FB_ADMIN_OP_LIST_PROPERTIES) {
21 $return[t('Profile Tab Name')] = 'tab_default_name';
22 $return[t('Profile Tab URL')] = 'profile_tab_url';
d01ea23e
DC
23 $return[t('Profile Tab Edit URL')] = 'edit_url';
24 $return[t('Installable')] = 'installable';
5441e7bd
DC
25 }
26}
27
28/**
29 * See fb_tab_form_alter.
30 */
31function fb_tab_admin_form_alter(&$form, &$form_state, $form_id) {
32 // Add our settings to the fb_app edit form.
33 if (isset($form['fb_app_data']) && is_array($form['fb_app_data'])) {
34 $fb_app = $form['#fb_app'];
d01ea23e 35 $config = _fb_tab_get_config($fb_app);
5441e7bd
DC
36
37 $form['fb_app_data']['fb_tab'] = array(
38 '#type' => 'fieldset',
39 '#collapsible' => TRUE,
d8f85b06 40 '#collapsed' => isset($fb_app->label),
5441e7bd
DC
41 '#title' => t('Facebook profile tabs'),
42 '#description' => t('Settings which apply to <a href=!url target=_blank>profile tabs</a>.',
43 array('!url' => 'http://developers.facebook.com/docs/guides/canvas/#tabs')),
44 );
d01ea23e 45
5441e7bd 46 // Override themes
3cf45120 47 $themes = system_get_info('theme');
5441e7bd
DC
48 ksort($themes);
49 $theme_options[0] = t('System default');
3cf45120
DC
50 foreach ($themes as $key => $theme) {
51 $theme_options[$key] = $theme['name'];
5441e7bd
DC
52 }
53 $form['fb_app_data']['fb_tab']['custom_theme'] = array(
54 '#type' => 'select',
55 '#title' => t('Theme for profile tabs'),
56 '#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.'),
57 '#options' => $theme_options,
58 '#required' => TRUE,
59 '#default_value' => $config['custom_theme'],
60 );
61
62 // Properties: http://developers.facebook.com/docs/appproperties
63 $form['fb_app_data']['fb_tab']['tab_default_name'] = array(
64 '#type' => 'textfield',
65 '#title' => 'Tab name',
66 '#default_value' => $config['tab_default_name'],
fad0ac32 67 '#description' => t('A very short title.'),
5441e7bd
DC
68 );
69 $form['fb_app_data']['fb_tab']['profile_tab_url'] = array(
70 '#type' => 'textfield',
71 '#title' => 'Path',
72 '#default_value' => $config['profile_tab_url'],
fad0ac32 73 '#description' => t('Recommended value is %tab_path. You may choose another if you have defined a custom menu item or view.', array('%tab_path' => FB_TAB_PATH_VIEW)),
5441e7bd 74 );
d01ea23e
DC
75 /* XXX is this used by facebook?
76 $form['fb_app_data']['fb_tab']['edit_url'] = array(
77 '#type' => 'textfield',
78 '#title' => 'Edit URL',
79 '#default_value' => $config['edit_url'],
80 '#description' => t('Recommended value is %edit_url.', array(
81 '%edit_url' => url(FB_TAB_PATH_FORM, array('absolute'=> TRUE)))),
82 );
83 $form['fb_app_data']['fb_tab']['edit_url']['#description'] .= '<br/>' . t('Note that this field is apparently unused by facebook.');
84 */
5441e7bd
DC
85 }
86}