You are here

function finder_clone in Finder 7

Same name and namespace in other branches
  1. 6 finder.module \finder_clone()

Write a finder into the database as a new finder.

Parameters

$old_finder: The finder object to clone.

Return value

The new finder object.

1 call to finder_clone()
finder_admin_import in includes/finder.admin.inc
Admin finder import page.

File

./finder.module, line 555
The finder module.

Code

function finder_clone($old_finder) {
  $finder = clone $old_finder;
  finder_invoke_finderapi($finder, 'finder_clone');
  unset($finder->finder_id);
  finder_save($finder);
  foreach ($finder->elements as $key => $finder_element) {
    unset($finder_element->finder_element_id);
    $finder_element->finder_id = $finder->finder_id;
    finder_element_save($finder_element);
    $finder->elements[$key] = $finder_element;
  }
  return $finder;
}