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-08-29 07:07:24 +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
|
|
|
{
|
2015-11-23 04:53:45 +01:00
|
|
|
if ($subsite = Subsite::currentSubsite()) {
|
|
|
|
if ($theme = $subsite->Theme) {
|
2017-08-28 11:52:32 +02:00
|
|
|
SSViewer::set_themes([$theme, SSViewer::DEFAULT_THEME]);
|
2015-11-23 04:53:45 +01:00
|
|
|
}
|
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
|
|
|
{
|
2015-11-23 04:53:45 +01:00
|
|
|
if ($subsite = Subsite::currentSubsite()) {
|
|
|
|
return $subsite;
|
|
|
|
}
|
2017-05-24 15:26:28 +02:00
|
|
|
}
|
2012-03-25 18:35:01 +02:00
|
|
|
}
|