-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPresenter.php
More file actions
54 lines (45 loc) · 1.63 KB
/
Copy pathPresenter.php
File metadata and controls
54 lines (45 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php namespace Feather\Presenter;
class Presenter {
/**
* Illuminate application instance.
*
* @var Illuminate\Foundation\Application
*/
protected $app;
/**
* Create a new theme instance.
*
* @param Illuminate\Foundation\Application $app
* @return void
*/
public function __construct($app)
{
$this->app = $app;
}
/**
* Prepare the theme by requiring a starter file if it exists.
*
* @return void
*/
public function prepare()
{
// If we are within theme development mode and not running within the console then we'll publish the current themes
// assets. This is especially handy when you're making a lot of changes to your themes assets.
if ($this->app['config']->get('feather.forum.theme_development_mode') and ! $this->app->runningInConsole())
{
$this->app['artisan']->call('feather:publish', array('name' => $this->app['config']->get('feather::forum.theme'), '--theme' => true));
}
// Assign a namespace and some cascading paths so that view files are first searched
// for within a theme then within the core view directory.
$this->app['view']->addLocation($this->app['path.themes'].'/'.$this->app['config']->get('feather.forum.theme').'/views');
$this->app['view']->addLocation($this->app['path'].'/views');
// If the theme has a start file require the file to bootstrap the theme.
$start = $this->app['path.themes'].'/'.$this->app['config']->get('feather.forum.theme').'/start.php';
if ($this->app['files']->exists($start))
{
// We'll make $app available to our start scripts so that they can access bound data and components.
$app = $this->app;
require $start;
}
}
}