You are here

function apachesolr_search_page_clone in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 apachesolr_search.module \apachesolr_search_page_clone()
  2. 7 apachesolr_search.module \apachesolr_search_page_clone()

Function that clones a search page

Parameters

$page_id: The page identifier it needs to clone.

1 call to apachesolr_search_page_clone()
apachesolr_search_clone_search_page_confirm_submit in ./apachesolr_search.admin.inc
Submits the confirmations of the cloning of a search page

File

./apachesolr_search.module, line 419
Provides a content search implementation for node content for use with the Apache Solr search application.

Code

function apachesolr_search_page_clone($page_id) {
  $search_page = apachesolr_search_page_load($page_id);

  // Get all search_pages
  $search_pages = apachesolr_search_load_all_search_pages();

  // Create an unique ID
  $new_search_page_id = apachesolr_create_unique_id($search_pages, $search_page['page_id']);

  // Set this id to the new search page
  $search_page['page_id'] = $new_search_page_id;
  $search_page['label'] = $search_page['label'] . ' [cloned]';

  // All cloned search pages should be removable
  if (isset($search_page['settings']['apachesolr_search_not_removable'])) {
    unset($search_page['settings']['apachesolr_search_not_removable']);
  }

  // Save our new search page in the database
  apachesolr_search_page_save($search_page);
}