I'm attempting to make something occur at a specific event in the GatherContent module found here https://www.drupal.org/project/gathercontent
Based on the information here http://help.gathercontent.com/importing-and-exporting-content/drupal-integration/drupal-integration-extending-the-module-using-the-api and several tutorials and documentation
I created a module with the code entered like so
my_gathercontent.services.yml
services:
my_gathercontent:
class: '\Drupal\my_gathercontent\EventSubscriber\MyGatherContentSubscriber'
tags:
- { name: 'event_subscriber' }
src/EventSubscriber/MyGatherContentSubscriber.php
namespace Drupal\my_gathercontent\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Event Subscriber MyGatherContentSubscriber.
*/
class MyGatherContentSubscriber implements EventSubscriberInterface {
public function onGatherContentPostImport(DrupalgathercontentEventPostImportEvent $event) {
\Drupal::logger('my_gathercontent')->notice('This is a test');
drupal_set_message("Debug: This is a test.");
var_dump($event);
}
public static function getSubscribedEvents() {
$events['gathercontent.post_import'] = ['onGatherContentPostImport'];
return $events;
}
}
And none of those messages get logged. I do now receive a page not found message after performing an action that should trigger that event. I'm not sure what I'm doing wrong.
Is there something wrong with the way I'm attempting to subscribe to the event?