I'm using entity_print for PDF generation on two node types. I'd like each to have its own orientation configuration (or just have one override the default). There is an event in entity_print where configuration can be set at run-time, so I have a simple event subscriber, with a method to override the orientation, but I can't seem to get the last piece, which is the entity (bundle label) to switch on.

How can an event subscriber have access to the entity type?

  • 1
    You have an entity object in code? You should have a bundle() method to return the type. Node also has the convienient method getType() for node objects to get their node type.
    – Kevin
    Commented Nov 17, 2017 at 22:40
  • @Kevin That's the problem, the event object is only storing the type of the print object, not the object being printed. I think upon further investigation, I may actually need to subscribe to a pre-send event to get this.
    – Steve
    Commented Nov 18, 2017 at 20:59

1 Answer 1


The event should have the entities its acting on. Have you tried the following?

$entities = $event->getEntities();

To get the bundle:

$bundle = $event->getEntities()[0]->bundle();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.