Add InPost Pay integration to admin templates
- Created a new template for the cart rule form with custom label, switch, and choice widgets. - Implemented the InPost Pay block in the order details template for displaying delivery method, APM, and VAT invoice request. - Added legacy support for the order details template to maintain compatibility with older PrestaShop versions.
This commit is contained in:
59
modules/inpostizi/src/Event/Adapter/EventDispatcher.php
Normal file
59
modules/inpostizi/src/Event/Adapter/EventDispatcher.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace izi\prestashop\Event\Adapter;
|
||||
|
||||
use izi\prestashop\Event\Event;
|
||||
use izi\prestashop\Event\EventDispatcherInterface as ModuleEventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as ContractsEventDispatcherInterface;
|
||||
|
||||
/**
|
||||
* @mixin EventDispatcherInterface
|
||||
*/
|
||||
final class EventDispatcher implements ModuleEventDispatcher
|
||||
{
|
||||
/**
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
private $dispatcher;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $isLegacyDispatcher;
|
||||
|
||||
public function __construct(EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->isLegacyDispatcher = !$this->dispatcher instanceof ContractsEventDispatcherInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch(Event $event, ?string $eventName = null): Event
|
||||
{
|
||||
$eventName = $eventName ?? get_class($event);
|
||||
|
||||
return $this->isLegacyDispatcher
|
||||
? $this->dispatcher->dispatch($eventName, $event)
|
||||
: $this->dispatcher->dispatch($event, $eventName);
|
||||
}
|
||||
|
||||
public function addListener(string $eventName, callable $listener, int $priority = 0): void
|
||||
{
|
||||
$this->dispatcher->addListener($eventName, $listener, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards calls to the inner dispatcher.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call(string $name, array $arguments)
|
||||
{
|
||||
return $this->dispatcher->$name(...$arguments);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user