class WebformEntityPrintCssAlterSubscriber 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
Event subscriber to alter entity print css.
Hierarchy
- class \Drupal\webform_entity_print\EventSubscriber\WebformEntityPrintCssAlterSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of WebformEntityPrintCssAlterSubscriber
See also
\Drupal\entity_print\Asset\AssetCollector::getCssLibraries
1 string reference to 'WebformEntityPrintCssAlterSubscriber'
- webform_entity_print.services.yml in modules/
webform_entity_print/ webform_entity_print.services.yml - modules/webform_entity_print/webform_entity_print.services.yml
1 service uses WebformEntityPrintCssAlterSubscriber
File
- modules/
webform_entity_print/ src/ EventSubscriber/ WebformEntityPrintCssAlterSubscriber.php, line 14
Namespace
Drupal\webform_entity_print\EventSubscriberView source
class WebformEntityPrintCssAlterSubscriber implements EventSubscriberInterface {
/**
* React to a config object being saved.
*
* @param \Drupal\entity_print\Event\PrintCssAlterEvent $event
* Entity Print CSS alter event.
*/
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';
}
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
PrintEvents::CSS_ALTER => 'alterCss',
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WebformEntityPrintCssAlterSubscriber:: |
public | function | React to a config object being saved. | |
WebformEntityPrintCssAlterSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. |