<?php
/*
* Plugin Name : HiddenDeliveryDate
*
* Copyright (C) BraTech Co., Ltd. All Rights Reserved.
* http://www.bratech.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Plugin\HiddenDeliveryDate42\Event;
use Eccube\Event\EventArgs;
use Plugin\HiddenDeliveryDate42\Service\ShoppingService;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class DeliveryDateEvent implements EventSubscriberInterface
{
private $shoppingService;
public function __construct(
ShoppingService $shoppingService
)
{
$this->shoppingService = $shoppingService;
}
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
'deliverydate.getformdeliverydates' => 'hookGetDeliveryDates',
];
}
public function hookGetDeliveryDates(EventArgs $event)
{
$deliveryDates = $event->getArgument('deliveryDates');
$Shipping = $event->getArgument('Shipping');
$attrs = $this->shoppingService->getHiddenDeliveryAttrs($deliveryDates, $Shipping);
$event->setArgument('attrs', $attrs);
}
}