You are here

function apachesolr_search_delete_search_page_confirm in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 apachesolr_search.admin.inc \apachesolr_search_delete_search_page_confirm()
  2. 7 apachesolr_search.admin.inc \apachesolr_search_delete_search_page_confirm()

Deletes a single search page configuration.

1 string reference to 'apachesolr_search_delete_search_page_confirm'
apachesolr_search_menu in ./apachesolr_search.module
Implements hook_menu().

File

./apachesolr_search.admin.inc, line 586
Administrative settings for searching.

Code

function apachesolr_search_delete_search_page_confirm(&$form_state, $search_page) {
  $form = array();

  // Sets values required for deletion.
  $form['page_id'] = array(
    '#type' => 'value',
    '#value' => $search_page['page_id'],
  );
  $form['label'] = array(
    '#type' => 'value',
    '#value' => $search_page['label'],
  );
  if (isset($search_page['export_type']) && $search_page['export_type'] == '3') {
    $verb = t('Revert');
  }
  else {
    $verb = t('Delete');
  }

  // Sets the message, or the title of the page.
  $message = t('Are you sure you want to !verb the %label search page configuration?', array(
    '%label' => $form['label']['#value'],
    '!verb' => strtolower($verb),
  ));

  // Builds caption.
  $caption = '<p>';
  $caption .= t('The %label search page configuration will be deleted.', array(
    '%label' => $form['label']['#value'],
  ));
  $caption .= '</p>';
  $caption .= '<p><strong>' . t('This action cannot be undone.') . '</strong></p>';

  // Finalizes and returns the confirmation form.
  $return_path = 'admin/settings/apachesolr/search-pages';
  $button_text = $verb;
  if (!isset($search_page['settings']['apachesolr_search_not_removable'])) {
    return confirm_form($form, filter_xss($message), $return_path, filter_xss($caption), check_plain($button_text));
  }
  else {

    // Maybe this should be solved somehow else
    drupal_access_denied();
  }
}