class FeedsSubscriber in Feeds 8.3
React on authors being processed.
Hierarchy
- class \Drupal\feeds_test_events\EventSubscriber\FeedsSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of FeedsSubscriber
1 file declares its use of FeedsSubscriber
- FeedsEventsTest.php in tests/
src/ Kernel/ FeedsEventsTest.php
1 string reference to 'FeedsSubscriber'
- feeds_test_events.services.yml in tests/
modules/ feeds_test_events/ feeds_test_events.services.yml - tests/modules/feeds_test_events/feeds_test_events.services.yml
1 service uses FeedsSubscriber
- feeds_test_events.subscriber in tests/
modules/ feeds_test_events/ feeds_test_events.services.yml - Drupal\feeds_test_events\EventSubscriber\FeedsSubscriber
File
- tests/
modules/ feeds_test_events/ src/ EventSubscriber/ FeedsSubscriber.php, line 22
Namespace
Drupal\feeds_test_events\EventSubscriberView source
class FeedsSubscriber implements EventSubscriberInterface {
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
FeedsEvents::FEEDS_DELETE => [
'onDelete',
],
FeedsEvents::INIT_IMPORT => [
'onInitImport',
],
FeedsEvents::FETCH => [
[
'preFetch',
FeedsEvents::BEFORE,
],
[
'postFetch',
FeedsEvents::AFTER,
],
],
FeedsEvents::PARSE => [
[
'preParse',
FeedsEvents::BEFORE,
],
[
'postParse',
FeedsEvents::AFTER,
],
],
FeedsEvents::PROCESS => [
[
'preProcess',
FeedsEvents::BEFORE,
],
[
'postProcess',
FeedsEvents::AFTER,
],
],
FeedsEvents::PROCESS_ENTITY_PREVALIDATE => [
'prevalidate',
],
FeedsEvents::PROCESS_ENTITY_PRESAVE => [
'preSave',
],
FeedsEvents::PROCESS_ENTITY_POSTSAVE => [
'postSave',
],
FeedsEvents::CLEAN => [
'onClean',
],
FeedsEvents::INIT_CLEAR => [
'onInitClear',
],
FeedsEvents::CLEAR => [
'onClear',
],
FeedsEvents::INIT_EXPIRE => [
'onInitExpire',
],
FeedsEvents::EXPIRE => [
'onExpire',
],
FeedsEvents::IMPORT_FINISHED => [
'onFinish',
],
];
}
/**
* Acts on multiple feeds getting deleted.
*/
public function onDelete(DeleteFeedsEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on an import being initiated.
*/
public function onInitImport(InitEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on event before fetching.
*/
public function preFetch(FetchEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on fetcher result.
*/
public function postFetch(FetchEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on event before parsing.
*/
public function preParse(ParseEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on parser result.
*/
public function postParse(ParseEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on event before processing.
*/
public function preProcess(ProcessEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on process result.
*/
public function postProcess(ProcessEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on an entity before validation.
*/
public function prevalidate(EntityEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
$feed_type_id = $event
->getFeed()
->getType()
->id();
switch ($feed_type_id) {
case 'no_title':
// A title is required, set a title on the entity to prevent validation
// errors.
$event
->getEntity()->title = 'foo';
break;
}
}
/**
* Acts on presaving an entity.
*/
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;
}
}
/**
* Acts on postsaving an entity.
*/
public function postSave(EntityEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on the cleaning stage.
*/
public function onClean(CleanEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on event before deleting items begins.
*/
public function onInitClear(InitEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on event where deleting items has began.
*/
public function onClear(ClearEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on event before expiring items begins.
*/
public function onInitExpire(InitEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on event where expiring items has began.
*/
public function onExpire(ExpireEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
/**
* Acts on the completion of an import.
*/
public function onFinish(ImportFinishedEvent $event) {
$GLOBALS['feeds_test_events'][] = __METHOD__ . ' called';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FeedsSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
FeedsSubscriber:: |
public | function | Acts on the cleaning stage. | |
FeedsSubscriber:: |
public | function | Acts on event where deleting items has began. | |
FeedsSubscriber:: |
public | function | Acts on multiple feeds getting deleted. | |
FeedsSubscriber:: |
public | function | Acts on event where expiring items has began. | |
FeedsSubscriber:: |
public | function | Acts on the completion of an import. | |
FeedsSubscriber:: |
public | function | Acts on event before deleting items begins. | |
FeedsSubscriber:: |
public | function | Acts on event before expiring items begins. | |
FeedsSubscriber:: |
public | function | Acts on an import being initiated. | |
FeedsSubscriber:: |
public | function | Acts on fetcher result. | |
FeedsSubscriber:: |
public | function | Acts on parser result. | |
FeedsSubscriber:: |
public | function | Acts on process result. | |
FeedsSubscriber:: |
public | function | Acts on postsaving an entity. | |
FeedsSubscriber:: |
public | function | Acts on event before fetching. | |
FeedsSubscriber:: |
public | function | Acts on event before parsing. | |
FeedsSubscriber:: |
public | function | Acts on event before processing. | |
FeedsSubscriber:: |
public | function | Acts on presaving an entity. | |
FeedsSubscriber:: |
public | function | Acts on an entity before validation. |