You are here

function search_by_page_paths_delete_confirm_submit in Search by Page 8

Submit callback for search_by_page_paths_delete_confirm().

Actually deletes the path.

File

search_by_page_paths/search_by_page_paths.module, line 524
Module file for Search by Page Paths, a sub-module for Search by Page.

Code

function search_by_page_paths_delete_confirm_submit($form, &$form_state) {
  if (!$form_state['values']['confirm']) {
    return;
  }
  $pid = $form_state['values']['pid'];
  if (!$pid) {
    return;
  }

  // Remove it from our database, and also from current search index
  \Drupal::database()
    ->delete('sbpp_path')
    ->condition('pid', $pid)
    ->execute();
  $environment = intval($form_state['values']['environment']);
  search_by_page_force_remove('search_by_page_paths', $pid, $environment);

  // Go back to paths page
  $form_state['redirect'] = 'admin/config/search/search_by_page/edit/' . $environment . '/paths';
}