function ccl_add_form_submit in Custom Contextual Links 7
Same name and namespace in other branches
- 8 ccl.admin.inc \ccl_add_form_submit()
Submit handler for ccl_add_form().
See also
1 call to ccl_add_form_submit()
- ccl_actions_form_submit in ccl_actions/
ccl_actions.module - Submit handler for ccl_actions_form().
File
- ./
ccl.admin.inc, line 306 - Provides administrative functions for ccl.
Code
function ccl_add_form_submit($form, &$form_state) {
// Clean up the values array.
form_state_values_clean($form_state);
$values = $form_state['values'];
// Extract the options out of the values.
$options = array();
foreach ($values as $key => $data) {
if (strpos($key, 'ccl_') === FALSE) {
$options[$key] = $data;
}
}
$record = array(
'type' => $values['ccl_type'],
'title' => $values['ccl_title'],
'link' => $values['ccl_link'],
'options' => serialize($options),
);
if (isset($form_state['clid'])) {
$record['clid'] = $form_state['clid'];
$res = drupal_write_record('ccl', $record, 'clid');
}
else {
$res = drupal_write_record('ccl', $record);
}
if ($res) {
drupal_set_message(t('Contextual link saved.'));
_ccl_update_cache();
}
else {
drupal_set_message(t('There was an error writing this record to the database. Please try again.'), 'error');
}
drupal_goto('admin/config/user-interface/ccl');
}