<?php
namespace Plugin\ClaimPdf42\EventListener;
use Eccube\Event\TemplateEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ClaimPdfEvent implements EventSubscriberInterface
{
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
'@admin/Order/index.twig' => 'adminOrderIndexTwig',
'@admin/Order/edit.twig' => 'adminOrderEditTwig',
'@admin/Order/shipping.twig' => 'adminOrderShippingTwig',
];
}
/**
* @param TemplateEvent $event
*/
public function adminOrderIndexTwig(TemplateEvent $event)
{
$indexhtml = $event->getSource();
$indexhtml = str_replace('admin_order_export_pdf', 'admin_order_export_claimpdf', $indexhtml);
$event->setSource($indexhtml);
}
/**
* @param TemplateEvent $event
*/
public function adminOrderEditTwig(TemplateEvent $event)
{
$edithtml = $event->getSource();
$edithtml = str_replace('admin_order_export_pdf', 'admin_order_export_claimpdf', $edithtml);
$event->setSource($edithtml);
}
/**
* @param TemplateEvent $event
*/
public function adminOrderShippingTwig(TemplateEvent $event)
{
$shippinghtml = $event->getSource();
$shippinghtml = str_replace('admin_order_export_pdf', 'admin_order_export_claimpdf', $shippinghtml);
$event->setSource($shippinghtml);
}
}