class EntityPrintSubscriber in Commerce Invoice 8.2
Add our CSS for the invoice PDFS.
Hierarchy
- class \Drupal\commerce_invoice\EventSubscriber\EntityPrintSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of EntityPrintSubscriber
1 string reference to 'EntityPrintSubscriber'
1 service uses EntityPrintSubscriber
File
- src/
EventSubscriber/ EntityPrintSubscriber.php, line 12
Namespace
Drupal\commerce_invoice\EventSubscriberView source
class EntityPrintSubscriber implements EventSubscriberInterface {
/**
* Alter the CSS renderable array and add our CSS.
*
* @param \Drupal\entity_print\Event\PrintCssAlterEvent $event
* The event object.
*/
public function alterCss(PrintCssAlterEvent $event) {
$event
->getBuild()['#attached']['library'][] = 'commerce_invoice/entity-print-styling';
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
PrintEvents::CSS_ALTER => 'alterCss',
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityPrintSubscriber:: |
public | function | Alter the CSS renderable array and add our CSS. | |
EntityPrintSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. |