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;
|
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
|
|
|
{
|
|
|
|
if ($subsite = Subsite::currentSubsite()) {
|
|
|
|
if ($theme = $subsite->Theme) {
|
2017-06-01 14:57:28 +02:00
|
|
|
SSViewer::set_themes([$theme, SSViewer::DEFAULT_THEME]);
|
2017-05-24 15:26:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-05-24 12:32:05 +02:00
|
|
|
|
2017-05-29 13:42:42 +02:00
|
|
|
public function CurrentSubsite()
|
2017-05-24 15:26:28 +02:00
|
|
|
{
|
|
|
|
if ($subsite = Subsite::currentSubsite()) {
|
|
|
|
return $subsite;
|
|
|
|
}
|
|
|
|
}
|
2017-04-23 22:23:34 +02:00
|
|
|
|
2012-03-25 18:35:01 +02:00
|
|
|
}
|