428.1.40
by Dan Garner
Get theme's working again, including the option to override Twig Views. |
1 |
<?php
|
2 |
/*
|
|
3 |
* Spring Signage Ltd - http://www.springsignage.com
|
|
4 |
* Copyright (C) 2015 Spring Signage Ltd
|
|
5 |
* (Theme.php)
|
|
6 |
*/
|
|
7 |
||
8 |
||
9 |
namespace Xibo\Middleware; |
|
10 |
||
11 |
||
12 |
use Slim\Middleware; |
|
13 |
||
14 |
class Theme extends Middleware |
|
15 |
{
|
|
16 |
public function call() |
|
17 |
{
|
|
18 |
// Configure the Theme
|
|
19 |
\Xibo\Helper\Theme::getInstance(); |
|
20 |
||
21 |
// Inject our Theme into the Twig View (if it exists)
|
|
22 |
$app = $this->getApplication(); |
|
23 |
||
454.1.34
by Dan Garner
Implement theme selector and "hide_others" theme option |
24 |
// Does this theme provide an alternative view path?
|
25 |
if (\Xibo\Helper\Theme::getConfig('view_path') != '') { |
|
26 |
// Provide the view path to Twig
|
|
27 |
$twig = $app->view()->getInstance()->getLoader(); |
|
28 |
/* @var \Twig_Loader_Filesystem $twig */
|
|
29 |
$twig->prependPath(\Xibo\Helper\Theme::getConfig('view_path')); |
|
30 |
}
|
|
428.1.40
by Dan Garner
Get theme's working again, including the option to override Twig Views. |
31 |
|
32 |
// Call Next
|
|
33 |
$this->next->call(); |
|
34 |
}
|
|
35 |
}
|