FIX: Ensure that theme is detected properly

This commit is contained in:
Tom Densham 2013-05-24 18:13:04 +12:00 committed by Will Rossiter
parent 7bbfe62883
commit ba51f661d4
2 changed files with 5 additions and 10 deletions

View File

@ -173,11 +173,12 @@ class FilesystemPublisher extends StaticPublisher {
// or we can use the last non-null theme.
$customTheme = Config::inst()->get('StaticPublisher', 'static_publisher_theme');
if(!$customTheme) {
Config::inst()->update('SSViewer', 'theme', Config::inst()->get('SSViewer', 'custom_theme'));
} else {
if($customTheme) {
Config::inst()->update('SSViewer', 'theme', $customTheme);
}
// Ensure that the theme that is set gets used.
Config::inst()->update('SSViewer', 'theme_enabled', true);
$currentBaseURL = Director::baseURL();
$staticBaseUrl = Config::inst()->get('FilesystemPublisher', 'static_base_url');

View File

@ -144,12 +144,6 @@ class FilesystemPublisherTest extends SapphireTest {
$current_theme=SSViewer::current_custom_theme();
$this->assertEquals($current_theme, $default_theme, 'After a standard publication, the theme is correct');
//The CMS sometimes sets the theme to null. Check that the $current_custom_theme is still the default
SSViewer::set_theme(null);
$current_theme=SSViewer::current_custom_theme();
$this->assertEquals($current_theme, $default_theme, 'After a setting the theme to null, the default theme is correct');
//We can set the static_publishing theme to something completely different:
//Static publishing will use this one instead of the current_custom_theme if it is not false
StaticPublisher::set_static_publisher_theme('otherTheme');
@ -204,4 +198,4 @@ class StaticPublisherTestPage extends Page implements TestOnly {
class StaticPublisherTestPage_Controller extends Page_Controller {
}
}