function fb_app_form in Drupal for Facebook 5
Same name and namespace in other branches
- 5.2 fb_app.module \fb_app_form()
File
- ./fb_app.module, line 103
- Defines a custom node type that stores a facebook application configuration.
Code
function fb_app_form(&$node, &$param) {
if (!$node->nid) {
drupal_set_message(t("Before completing this form, <a href=!url>create your application</a> on Facebook.", array(
'!url' => 'http://www.facebook.com/developers/editapp.php?new',
)));
}
$form = array();
$type = node_get_types('type', $node);
$form['title'] = array(
'#type' => 'textfield',
'#title' => check_plain($type->title_label),
'#required' => TRUE,
'#default_value' => $node->title,
'#weight' => -5,
'#description' => t('Identifies the application to site administrators.'),
);
$form['body_filter']['body'] = array(
'#type' => 'textarea',
'#title' => check_plain($type->body_label),
'#default_value' => $node->body,
'#required' => FALSE,
'#description' => 'Not sure yet how this will be used.',
);
$form['body_filter']['filter'] = filter_form($node->format);
$form['fb_app'] = array(
'#tree' => TRUE,
'#weight' => -4,
);
$form['fb_app']['label'] = array(
'#type' => 'textfield',
'#title' => t('Label'),
'#required' => TRUE,
'#default_value' => $node->fb_app->label,
'#description' => t('Used behind the scenes, for naming roles, styles, etc. Use no spaces or weird characters.'),
);
$form['fb_app']['apikey'] = array(
'#type' => 'textfield',
'#title' => t('API Key'),
'#required' => TRUE,
'#default_value' => $node->fb_app->apikey,
'#description' => t('Facebook will generate this value when you create the application.'),
);
$form['fb_app']['secret'] = array(
'#type' => 'textfield',
'#title' => t('Secret'),
'#required' => TRUE,
'#default_value' => $node->fb_app->secret,
'#description' => t('Facebook will generate this value when you create the application.'),
);
$form['fb_app']['canvas'] = array(
'#type' => 'textfield',
'#title' => t('Canvas Page Url Suffix'),
'#required' => TRUE,
'#default_value' => $node->fb_app->canvas,
'#description' => t('Type only the part that comes after "http://apps.facebook.com/"'),
);
$form['fb_app']['id'] = array(
'#type' => 'textfield',
'#title' => t('Facebook App ID'),
'#required' => FALSE,
'#default_value' => $node->fb_app->id,
'#description' => t('To learn this number, visit your app\'s About Page (or other links from Facebook\'s Developer App). The URL will end in ?id=1234... Enter the number that follows "?id=" here.'),
);
$form['fb_app_data'] = array(
'#tree' => TRUE,
);
return $form;
}