You are here

function disable_breadcrumbs_node_form_submit in Disable breadcrumbs 7

Same name and namespace in other branches
  1. 6 disable_breadcrumbs.module \disable_breadcrumbs_node_form_submit()

Submit handler to deal with

1 string reference to 'disable_breadcrumbs_node_form_submit'
disable_breadcrumbs_form_alter in ./disable_breadcrumbs.module
Implements hook_form_alter().

File

./disable_breadcrumbs.module, line 224
Disable breadcrumbs

Code

function disable_breadcrumbs_node_form_submit($form, $form_state) {

  // Get default value from form.
  $breadcrumb_status = $form_state['values']['disable_breadcrumb'];

  // Get value before update to db to check whether to display message on save
  $check_status = _disable_breadcrumbs_node_query($form_state['node']->nid) ? 1 : 0;
  if ($breadcrumb_status == 1 && $check_status == 0) {

    // Insert db record.
    disable_breadcrumbs_insert($form_state['node']->nid);
    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 ($breadcrumb_status == 0 && $check_status == 1) {

    // Remove db record.
    disable_breadcrumbs_delete($form_state['node']->nid);
    drupal_set_message(t("The breadcrumb for %title (node %nid) has been enabled.", array(
      '%nid' => $form_state['node']->nid,
      '%title' => $form_state['node']->title,
    )));
  }
}