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,12 +173,13 @@ class FilesystemPublisher extends StaticPublisher {
// or we can use the last non-null theme. // or we can use the last non-null theme.
$customTheme = Config::inst()->get('StaticPublisher', 'static_publisher_theme'); $customTheme = Config::inst()->get('StaticPublisher', 'static_publisher_theme');
if(!$customTheme) { if($customTheme) {
Config::inst()->update('SSViewer', 'theme', Config::inst()->get('SSViewer', 'custom_theme'));
} else {
Config::inst()->update('SSViewer', 'theme', $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(); $currentBaseURL = Director::baseURL();
$staticBaseUrl = Config::inst()->get('FilesystemPublisher', 'static_base_url'); $staticBaseUrl = Config::inst()->get('FilesystemPublisher', 'static_base_url');

View File

@ -144,12 +144,6 @@ class FilesystemPublisherTest extends SapphireTest {
$current_theme=SSViewer::current_custom_theme(); $current_theme=SSViewer::current_custom_theme();
$this->assertEquals($current_theme, $default_theme, 'After a standard publication, the theme is correct'); $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: //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 //Static publishing will use this one instead of the current_custom_theme if it is not false
StaticPublisher::set_static_publisher_theme('otherTheme'); StaticPublisher::set_static_publisher_theme('otherTheme');