cms.page.beforeDisplay

Triggered in Cms\Classes\Controller.

Provides an opportunity to swap the page that gets displayed immediately after loading the page assigned to the URL.

Example usage:

Event::listen('cms.page.beforeDisplay', function ((\Cms\Classes\Controller) $controller, (string) $url, (\Cms\Classes\Page) $page) {
    if ($url === '/tricked-you') {
        return \Cms\Classes\Page::loadCached('trick-theme-code', 'page-file-name');
    }
});

Or

$controller->bindEvent('page.beforeDisplay', function ((string) $url, (\Cms\Classes\Page) $page) {
    if ($url === '/tricked-you') {
        return \Cms\Classes\Page::loadCached('trick-theme-code', 'page-file-name');
    }
});