function fb_app_admin_form_submit in Drupal for Facebook 7.3
Same name and namespace in other branches
- 6.3 fb_app.admin.inc \fb_app_admin_form_submit()
- 6.2 fb_app.admin.inc \fb_app_admin_form_submit()
1 string reference to 'fb_app_admin_form_submit'
- fb_app_edit_form in ./fb_app.admin.inc
- Builds the form used to edit an application.
File
- ./fb_app.admin.inc, line 209
Code
function fb_app_admin_form_submit($form, &$form_state) {
$fb_app = (object) $form_state['values'];
$fb_app->data = serialize($fb_app->fb_app_data);
fb_admin_get_app_info($fb_app);
$orig_app = $form['#fb_app'];
if ($orig_app->fba_id) {
try {
db_update('fb_app')
->fields(array(
'label' => $fb_app->label,
'status' => $fb_app->status,
'apikey' => $fb_app->id,
'secret' => $fb_app->secret,
'id' => $fb_app->id,
'canvas' => !empty($fb_app->namespace) ? $fb_app->namespace : '',
'title' => !empty($fb_app->name) ? $fb_app->name : $fb_app->label,
'data' => $fb_app->data,
))
->condition('fba_id', $orig_app->fba_id)
->execute();
watchdog('fb_app', 'Updated Facebook Application %label.', array(
'%label' => $fb_app->label,
), WATCHDOG_NOTICE, l(t('view apps'), FB_PATH_ADMIN_APPS));
} catch (Exception $e) {
watchdog_exception('fb_app', $e);
drupal_set_message(t('Failed to save changes to facebook application %title (%label). Check the log.', array(
'%label' => $fb_app->label,
'%title' => $fb_app->name,
)));
}
drupal_set_message(t('Saved changes to Facebook application %title (%label).', array(
'%title' => $fb_app->name,
'%label' => $fb_app->label,
)));
drupal_set_message(t('Recommended: <a href=!cache_url>clear cached data</a> after changing Facebook app settings.', array(
'!cache_url' => url('admin/config/development/performance'),
)), 'warning');
}
else {
try {
db_insert('fb_app')
->fields(array(
'label' => $fb_app->label,
'status' => $fb_app->status,
'apikey' => $fb_app->id,
'secret' => $fb_app->secret,
'id' => $fb_app->id,
'canvas' => !empty($fb_app->namespace) ? $fb_app->namespace : '',
'title' => !empty($fb_app->name) ? $fb_app->name : $fb_app->label,
'data' => $fb_app->data,
))
->execute();
watchdog('fb_app', 'Created Facebook Application %label.', array(
'%label' => $fb_app->label,
), WATCHDOG_NOTICE, l(t('view apps'), FB_PATH_ADMIN_APPS));
drupal_set_message(t('Created facebook application %title (%label).', array(
'%label' => $fb_app->label,
'%title' => $fb_app->name,
)));
} catch (Exception $e) {
watchdog_exception('fb_app', $e);
drupal_set_message(t('Failed to create facebook application %title (%label). Check the log.', array(
'%label' => $fb_app->label,
'%title' => $fb_app->name,
)));
}
}
if ($fb_app->status) {
fb_app_set_app_properties($fb_app);
}
$form_state['redirect'] = FB_PATH_ADMIN;
}