I'm trying to set an event that will launch function that loads some data from outside server and print it to javascript div element. I tried many ways but I can't figure out how to make this event be called only on for a specific node type.
Code I got so far:
class eSubscriber implements EventSubscriberInterface {
public static function getSubscribedEvents() {
$events[KernelEvents::RESPONSE][] = ['onRespond',27]; //so far it works on respond but on every page
return $events;
}
public function onRespond(FilterResponseEvent $event) {
//do some stuff
}
}