diff --git a/Admin/Display/Context/DisplayContext.php b/Admin/Display/Context/DisplayContext.php index 46ceb44f..8343ebbd 100644 --- a/Admin/Display/Context/DisplayContext.php +++ b/Admin/Display/Context/DisplayContext.php @@ -60,9 +60,10 @@ public function setElement(Element $element): void protected function createEvent(Request $request): AdminEvent { - $this->display = $this->element->createDisplay($this->getObject($request)); + $object = $this->getObject($request); + $this->display = $this->element->createDisplay($object); - return new DisplayEvent($this->element, $request, $this->display); + return new DisplayEvent($this->element, $request, $this->display, $object); } protected function getSupportedRoute(): string diff --git a/Event/DisplayEvent.php b/Event/DisplayEvent.php index 59cbd6b3..929e6554 100644 --- a/Event/DisplayEvent.php +++ b/Event/DisplayEvent.php @@ -22,15 +22,29 @@ class DisplayEvent extends AdminEvent */ private $display; - public function __construct(Element $element, Request $request, Display $display) + /** + * @var mixed + */ + private $object; + + public function __construct(Element $element, Request $request, Display $display, $object) { parent::__construct($element, $request); $this->display = $display; + $this->object = $object; } public function getDisplay(): Display { return $this->display; } + + /** + * @return mixed + */ + public function getObject() + { + return $this->object; + } }