Skip to content

Commit

Permalink
Merge pull request #68 from SilbinaryWolf/feat-assetdir
Browse files Browse the repository at this point in the history
feat(Multisites): Upload::uploads_folder config now updates to the current Site asset folder. Tested on backend and frontend UserForms.
  • Loading branch information
Nathan authored Dec 14, 2016
2 parents f85066f + cfba28d commit bc52478
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion code/extensions/MultisitesControllerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,23 @@ public function onAfterInit() {
}

$site = Multisites::inst()->getCurrentSite();
if (!$site) {
return;
}

if($site && $theme = $site->getSiteTheme()) {
$theme = $site->getSiteTheme();
if ($theme) {
SSViewer::set_theme($theme);
}

// Update default uploads folder to site
$assetDir = Config::inst()->get('Upload', 'uploads_folder');
$folder = $site->Folder();
if ($folder->exists()) {
$siteAssetDir = ltrim($folder->getRelativePath(), ASSETS_DIR.'/');
$siteAssetDir = rtrim($siteAssetDir, '/');
Config::inst()->update('Upload', 'uploads_folder', $siteAssetDir);
}
}

/**
Expand Down

0 comments on commit bc52478

Please sign in to comment.