public function FeedsSubscriber::preSave in Feeds 8.3
Acts on presaving an entity.
File
- tests/
modules/ feeds_test_events/ src/ EventSubscriber/ FeedsSubscriber.php, line 130
Class
- FeedsSubscriber
- React on authors being processed.
Namespace
Drupal\feeds_test_events\EventSubscriberCode
public function preSave(EntityEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
$feed_type_id = $event
->getFeed()
->getType()
->id();
switch ($feed_type_id) {
case 'import_skip':
// We do not save the node called 'Lorem ipsum'.
if ($event
->getEntity()
->getTitle() == 'Lorem ipsum') {
throw new EmptyFeedException();
}
break;
}
}