protected function getEvent($handle = 'default') { $event = new UpdateEvent(); $event->setHandles([$handle]); $event->setLayoutStructure($this->layoutStructure); return $event; }
/** * * @param UpdateEvent $event */ public function fetch(UpdateEvent $event) { $handles = $event->getHandles(); if ($area = $event->getArea()) { $this->setArea($area); } $this->layoutStructure = $event->getLayoutStructure(); foreach ($handles as $handle) { $this->fetchHandle($handle); } }
/** * * @return Config */ public function getLayoutStructure() { if (null === $this->layoutStructure) { $this->layoutStructure = new Config([], true); $handles = $this->getHandles(); $event = new UpdateEvent(); $event->setLayoutStructure($this->layoutStructure); $event->setHandles($handles); $event->setArea($this->getArea()); $event->setName(UpdateEvent::EVENT_COLLECT); $event->setTarget($this); $results = $this->getEventManager()->triggerEventUntil(function ($result) { return $result instanceof Config; }, $event); if ($results->stopped()) { $this->layoutStructure = $results->last(); } else { $this->fetchUpdates(); $event->setName(UpdateEvent::EVENT_COLLECT_POST); $this->getEventManager()->triggerEvent($event); } $this->layoutStructure->setReadOnly(); } return $this->layoutStructure; }
/** * * @return Config */ public function getLayoutStructure() { if (null === $this->layoutStructure) { $this->layoutStructure = new Config([], true); $handles = $this->getHandles(); $event = new UpdateEvent(); $event->setLayoutStructure($this->layoutStructure); $event->setHandles($handles); $event->setArea($this->getArea()); $results = $this->getEventManager()->trigger(__FUNCTION__ . '.pre', $this, $event, function ($result) { return $result instanceof Config; }); if ($results->stopped()) { $this->layoutStructure = $results->last(); } else { $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, $event); } $this->layoutStructure->setReadOnly(); } return $this->layoutStructure; }