silverstripe-subsites/code/extensions/ControllerSubsites.php
2017-05-29 13:42:42 +02:00

31 lines
598 B
PHP

<?php
namespace SilverStripe\Subsites\Extensions;
use SilverStripe\Core\Extension;
use SilverStripe\Subsites\Model\Subsite;
use SilverStripe\View\SSViewer;
/**
* @package subsites
*/
class ControllerSubsites extends Extension
{
public function controllerAugmentInit()
{
if ($subsite = Subsite::currentSubsite()) {
if ($theme = $subsite->Theme) {
SSViewer::set_theme($theme);
}
}
}
public function CurrentSubsite()
{
if ($subsite = Subsite::currentSubsite()) {
return $subsite;
}
}
}