2012-03-25 18:35:01 +02:00
|
|
|
<?php
|
2016-09-22 16:38:29 +02:00
|
|
|
|
2017-05-24 12:32:05 +02:00
|
|
|
namespace SilverStripe\Subsites\Extensions;
|
2017-06-01 15:57:53 +02:00
|
|
|
|
2016-09-22 16:38:29 +02:00
|
|
|
use SilverStripe\Core\Extension;
|
2017-05-24 12:32:05 +02:00
|
|
|
use SilverStripe\Subsites\Model\Subsite;
|
2017-05-24 15:26:28 +02:00
|
|
|
use SilverStripe\View\SSViewer;
|
2017-05-24 12:32:05 +02:00
|
|
|
|
2012-03-25 18:35:01 +02:00
|
|
|
/**
|
|
|
|
* @package subsites
|
|
|
|
*/
|
2017-05-24 15:26:28 +02:00
|
|
|
class ControllerSubsites extends Extension
|
|
|
|
{
|
2017-04-23 22:23:34 +02:00
|
|
|
|
2017-05-29 13:42:42 +02:00
|
|
|
public function controllerAugmentInit()
|
2017-05-24 15:26:28 +02:00
|
|
|
{
|
2017-06-01 15:57:53 +02:00
|
|
|
$subsite = $this->CurrentSubsite();
|
|
|
|
if ($subsite && $theme = $subsite->Theme) {
|
|
|
|
SSViewer::set_themes([$theme, SSViewer::DEFAULT_THEME]);
|
2017-05-24 15:26:28 +02:00
|
|
|
}
|
|
|
|
}
|
2017-05-24 12:32:05 +02:00
|
|
|
|
2017-06-01 15:57:53 +02:00
|
|
|
/**
|
|
|
|
* @return Subsite
|
|
|
|
*/
|
2017-05-29 13:42:42 +02:00
|
|
|
public function CurrentSubsite()
|
2017-05-24 15:26:28 +02:00
|
|
|
{
|
2017-06-01 15:57:53 +02:00
|
|
|
return Subsite::currentSubsite();
|
2017-05-24 15:26:28 +02:00
|
|
|
}
|
2017-04-23 22:23:34 +02:00
|
|
|
|
2012-03-25 18:35:01 +02:00
|
|
|
}
|