/** * Gets all ids that already exist in the post meta table from the provided records * * @param array $records Array of records * @param array $data Submitted data * * @return array */ protected function get_existing_ids_from_import_data($import_data) { $unique_field = $this->get_unique_field(); if (!$unique_field) { return array(); } $parent_selected_ids = array(); if (!empty($this->meta['ids_to_import']) && 'all' !== $this->meta['ids_to_import']) { if (is_array($this->meta['ids_to_import'])) { $selected_ids = $this->meta['ids_to_import']; } else { $selected_ids = json_decode($this->meta['ids_to_import']); } } else { $selected_ids = wp_list_pluck($import_data, $unique_field['source']); } if (empty($selected_ids)) { return array(); } $event_object = new Tribe__Events__Aggregator__Event(); $existing_ids = $event_object->get_existing_ids($this->meta['origin'], $selected_ids); return $existing_ids; }