Skip to content
Sunel Tr edited this page Jul 25, 2018 · 2 revisions

EventsDispatcher Contract

interface EventsDispatcher
{
    /**
     * Register an event listener with the dispatcher.
     *
     * @param  string $events
     * @param  mixed  $listener
     * @param  int    $priority
     * @return void
     */
    public function listen($event, $listener, $priority = 0);

    /**
     * Dispatch an event and call the listeners.
     *
     * @param  string $event
     * @param  mixed  $payload
     * @return void
     */
    public function fire($event, array $payload = []);
}

This system provide a flexible way of hooking into the layout at any point using events.

Events Params Description
route.layout.load.before
route.layout.generate.xml.before
route.layout.generate.blocks.before
block.prepare.layout.before
block.prepare.layout.after
layout.block.create.after
route.layout.generate.blocks.after
route.layout.render.before
route.layout.render.before.[page handle]
block.to.html.before
page.block.html.topmenu.getMenus.before
page.block.html.topmenu.getMenus.after