ShopEventManager (deprecated)

\Brandbox\ShopCore\Shop\Event\ShopEventManager dient als Übergangslösung für ältere Events, die noch nicht mit Framework 2.0 kompatibel sind. Konkret sind das →dispatchAll Events und ViewEvents.

Verwendung

Event Registrieren

Bsp. onBasketChangeEventInterface
<?php declare(strict_types=1); namespace Brandbox\MyApp\Shop\MyPackage\Lib\Event { use Brandbox\ShopCore\Shop\Checkout; use Brandbox\ShopCore\Shop\Event; class OnBasketChangeEvent extends Event\EventAbstract implements Checkout\lib\event\onBasketChangeEventInterface { const PRIORITY = 1; public function onBasketChange(): void { // Code } } }

ViewEvent Registrieren

Bsp. checkoutConfirmedAdditionalHtmlEventInterface
<?php namespace Brandbox\MyApp\Shop\MyPackage\Lib\Event {    use Brandbox\ShopCore\Shop\Event; use Brandbox\CmsLayoutShop\View\Checkout as ViewCheckout; use Brandbox\MyApp\Shop\MyPackage; class MyCheckoutConfirmedEvent extends Event\EventAbstract implements ViewCheckout\lib\event\checkoutConfirmedAdditionalHtmlEventInterface { public const PRIORITY = 1; private int $orderID; /** * @param array $parameters */ public function __construct($parameters) { $this->orderID = $parameters[self::PARAMETER_ORDER_ID]; } /** * @return Event\ViewInterface */ public function getView() { return new MyPackage\Lib\Event\MyCheckoutConfirmedView($this->orderID); } } } namespace Brandbox\MyApp\Shop\MyPackage\Lib\Event { use Brandbox\Framework\Brandbox\Controller; use Brandbox\ShopCore\Shop\Event; class MyCheckoutConfirmedView extends Controller\ControllerExecuteAbstract implements Event\ViewInterface { private int $orderID; public function __construct($orderID) { $this->orderID = $orderID; } /** * @return array|object */ public function getContext() { $result = new \stdClass(); return $result; } public function getPath(): string { return 'plugin/remote/brandbox/my-app/src/Shop/MyPackage/views/my-checkout-confirmed-view.hbs'; } } }