public static function FeedImport::saveFeed in Feed Import 8
Saves a feed in database
Parameters
object $feed: Feed info
8 calls to FeedImport::saveFeed()
- DynamicFilterForm::submitForm in src/
Form/ DynamicFilterForm.php - Form submission handler.
- EditFeedForm::submitForm in src/
Form/ EditFeedForm.php - Form submission handler.
- FeedImporterAddForm::submitForm in src/
Form/ FeedImporterAddForm.old.php - This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
- FieldsForm::submitForm in src/
Form/ FieldsForm.php - Form submission handler.
- FilterForm::submitForm in src/
Form/ FilterForm.php - Form submission handler.
File
- feed_import_base/
src/ FeedImport.php, line 342
Class
- FeedImport
- This class provides helper functions for feed import.
Namespace
Drupal\feed_import_baseCode
public static function saveFeed($feed) {
if (empty($feed->name) || empty($feed->machine_name) || empty($feed->entity) || empty($feed->settings)) {
return FALSE;
}
if (!isset($feed->cron_import)) {
$feed->cron_import = 0;
}
$fields = array(
'name' => $feed->name,
'machine_name' => $feed->machine_name,
'entity' => $feed->entity,
'cron_import' => (int) $feed->cron_import,
'settings' => serialize($feed->settings),
);
if (isset($feed->id)) {
db_update('feed_import_settings')
->fields($fields)
->condition('id', $feed->id)
->execute();
}
else {
$fields += array(
'last_run' => 0,
'last_run_duration' => 0,
'last_run_items' => 0,
);
db_insert('feed_import_settings')
->fields($fields)
->execute();
}
return TRUE;
}