You are here

function finder_admin_import in Finder 7

Same name and namespace in other branches
  1. 6 includes/finder.admin.inc \finder_admin_import()

Admin finder import page.

1 string reference to 'finder_admin_import'
finder_menu in ./finder.module
Implements hook_menu().

File

includes/finder.admin.inc, line 920
The finder admin screens.

Code

function finder_admin_import() {
  global $user;
  if (isset($_POST['finder_code']) && !empty($_POST['finder_code'])) {
    $finder_code = trim($_POST['finder_code']);
    $import = finder_import($finder_code);
    if (is_array($import)) {
      foreach ($import as $finder) {
        finder_invoke_finderapi($finder, 'finder_import');

        // Handle custom matching.
        finder_admin_import_custom_matching($import);
        $new_finder = finder_clone($finder);
        drupal_set_message(t('Imported !finder', array(
          '!finder' => l($new_finder->title, 'admin/structure/finder/' . $new_finder->finder_id . '/edit'),
        )));
      }
      drupal_goto('admin/structure/finder');
    }
    else {
      finder_invoke_finderapi($import, 'finder_import');

      // Handle custom matching.
      finder_admin_import_custom_matching($import);
      $new_finder = finder_clone($import);
      drupal_set_message(t('Imported !finder', array(
        '!finder' => l($new_finder->title, 'admin/structure/finder/' . $new_finder->finder_id . '/edit'),
      )));
      drupal_goto('admin/structure/finder/' . $new_finder->finder_id . '/edit');
    }
  }
  return drupal_get_form('finder_admin_import_form');
}