public function WebformEntityPrintCssAlterSubscriber::alterCss in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_entity_print/src/EventSubscriber/WebformEntityPrintCssAlterSubscriber.php \Drupal\webform_entity_print\EventSubscriber\WebformEntityPrintCssAlterSubscriber::alterCss()
React to a config object being saved.
Parameters
\Drupal\entity_print\Event\PrintCssAlterEvent $event: Entity Print CSS alter event.
File
- modules/
webform_entity_print/ src/ EventSubscriber/ WebformEntityPrintCssAlterSubscriber.php, line 22
Class
- WebformEntityPrintCssAlterSubscriber
- Event subscriber to alter entity print css.
Namespace
Drupal\webform_entity_print\EventSubscriberCode
public function alterCss(PrintCssAlterEvent $event) {
/** @var \Drupal\webform\WebformSubmissionInterface[] $entities */
$entities = $event
->getEntities();
foreach ($entities as $entity) {
if ($entity
->getEntityTypeId() === 'webform_submission') {
$event
->getBuild()['#attached']['library'][] = 'webform_entity_print/webform_entity_print';
}
}
}