function disable_breadcrumbs_node_form_submit in Disable breadcrumbs 6
Same name and namespace in other branches
- 7 disable_breadcrumbs.module \disable_breadcrumbs_node_form_submit()
1 string reference to 'disable_breadcrumbs_node_form_submit'
- disable_breadcrumbs_form_alter in ./
disable_breadcrumbs.module - Implementation of hook_form_alter().
File
- ./
disable_breadcrumbs.module, line 109 - Disable breadcrumbs
Code
function disable_breadcrumbs_node_form_submit($form_state) {
// Get value before update to db to check whether to display message on save
$check_status = _disable_breadcrumbs_node_query($form_state['nid']['#value']);
if ($form_state['breadcrumb']['disable_breadcrumb']['#value'] == 1 && $check_status !== 1) {
// Update db
$update_query = "INSERT INTO {disable_breadcrumbs} SET disable_breadcrumb = %d, nid = %d";
db_query($update_query, $form_state['breadcrumb']['disable_breadcrumb']['#value'], $form_state['nid']['#value']);
// Display confirmation if checkbox has been checked to disable node breadcrumb and status has changed
if ($form_state['breadcrumb']['disable_breadcrumb']['#value'] == 1 && $check_status == 0) {
drupal_set_message(t("The breadcrumb for %title (node %nid) has been disabled.", array(
'%nid' => $form_state['#node']->nid,
'%title' => $form_state['#node']->title,
)));
}
}
if ($form_state['breadcrumb']['disable_breadcrumb']['#value'] == 0 && $check_status == 1) {
//remove db record
$remove_query = "DELETE FROM {disable_breadcrumbs} WHERE nid = %d";
db_query($remove_query, $form_state['nid']['#value']);
}
}