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-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) {
|
|
|
|
SSViewer::set_theme($theme);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
}
|
2012-03-25 18:35:01 +02:00
|
|
|
}
|