public function InvoiceFilenameSubscriber::alterFilename in Commerce Invoice 8.2
Alters the invoice filename.
Parameters
\Drupal\commerce_invoice\Event\InvoiceFilenameEvent $event: The transition event.
File
- tests/
modules/ commerce_invoice_test/ src/ EventSubscriber/ InvoiceFilenameSubscriber.php, line 26
Class
Namespace
Drupal\commerce_invoice_test\EventSubscriberCode
public function alterFilename(InvoiceFilenameEvent $event) {
$invoice = $event
->getInvoice();
// Alter the filename if the "alter_filename" data flag is present.
if ($invoice
->getData('alter_filename')) {
$event
->setFilename($event
->getFilename() . '-altered');
}
}