Skip to content

Instantly share code, notes, and snippets.

@hissy
Created June 5, 2019 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hissy/b6a35dfe4b88e544a928c5bf667e4445 to your computer and use it in GitHub Desktop.
Save hissy/b6a35dfe4b88e544a928c5bf667e4445 to your computer and use it in GitHub Desktop.
#concrete5 Switch theme via request path for page not found
<?php
// Tested on 8.5.2a1
Events::addListener('on_before_render', function ($event) {
$view = $event->getArgument('view');
if ($view->getViewPath() == '/page_not_found') {
$request = \Request::getInstance();
if ($request->getPath() == '/foo' || $request->matches('/foo/*')) {
$view->setViewTheme('concrete');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment