function tweet_feed_feeds_form_submit in Tweet Feed 7.3
Same name and namespace in other branches
- 7.2 tweet_feed_admin.inc \tweet_feed_feeds_form_submit()
Submit handler for accounts form
Take the account information and either save it to a new record or update an existing one
File
- ./
tweet_feed_admin.inc, line 470
Code
function tweet_feed_feeds_form_submit($form, &$form_state) {
// Get a shortcut for our $form_state['values'] array
$values = $form_state['values'];
// Define our array of data provided by the form
$data = array(
'aid' => $values['aid'],
'feed_name' => $values['feed_name'],
'query_type' => $values['query_type'],
'timeline_id' => $values['timeline_id'],
'search_term' => $values['search_term'],
'list_name' => $values['list_name'],
'pull_count' => $values['pull_count'],
'clear_prior' => $values['clear_prior'],
'new_window' => $values['new_window'],
'hash_taxonomy' => 0,
);
// If aid is empty then we're creating a new record. Otherwise we are updating an
// existing one and need to call the proper drupal_write_record function accordingly.
if (!empty($values['fid'])) {
$data['fid'] = $values['fid'];
$status = drupal_write_record('tweet_feeds', $data, array(
'fid',
));
}
else {
$status = drupal_write_record('tweet_feeds', $data);
}
// Go back to the list of accounts when we are done.
$form_state['redirect'] = 'admin/config/services/tweet_feed/feeds';
// Set the status message based on the result we get from writing our record.
switch ($status) {
case SAVED_NEW:
drupal_set_message('New Twitter feed has been successfully added.', 'status');
break;
case SAVED_UPDATED:
drupal_set_message('Twitter feed has been successfully updated.', 'status');
break;
case FALSE:
default:
drupal_set_message('The Twitter feed details provided could not be properly saved to the database.', 'error');
break;
}
}