mirror of
https://github.com/silverstripe/silverstripe-staticpublisher
synced 2024-10-22 14:05:54 +02:00
FIX: Ensure that theme is detected properly
This commit is contained in:
parent
7bbfe62883
commit
ba51f661d4
@ -173,11 +173,12 @@ 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');
|
||||||
|
@ -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');
|
||||||
@ -204,4 +198,4 @@ class StaticPublisherTestPage extends Page implements TestOnly {
|
|||||||
|
|
||||||
class StaticPublisherTestPage_Controller extends Page_Controller {
|
class StaticPublisherTestPage_Controller extends Page_Controller {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user