You are here

function finder::save in Finder 7.2

Finder save.

File

includes/finder.inc, line 248
finder.inc

Class

finder
An object to contain all of the data to generate a finder, plus the member functions to build the finder, and render the output.

Code

function save() {
  module_invoke_all('finder_presave', $this);
  $update = array();
  $op = 'finder_insert';
  if (!empty($this->id)) {
    $update[] = 'id';
    $op = 'finder_update';
  }
  if (!empty($this->elements)) {
    foreach ($this->elements as $k => &$element) {
      $element->finder = $this->name;
      if (empty($element->id)) {
        unset($this->elements[$k]);
      }
    }
  }
  $return = drupal_write_record('finder', $this, $update);
  $this
    ->choice_repopulate();
  module_invoke_all($op, $this);
  cache_clear_all();
  menu_rebuild();
  return $return;
}