diff --git a/model/Versioned.php b/model/Versioned.php index f9445f6a4..399b2b50d 100644 --- a/model/Versioned.php +++ b/model/Versioned.php @@ -1215,9 +1215,13 @@ class Versioned extends DataExtension implements TemplateGlobalProvider { * @param SS_HTTPRequest|null $request */ public static function choose_site_stage(SS_HTTPRequest $request = null) { + if (!$request && Controller::has_curr()) { + $request = Controller::curr()->getRequest(); + } if (!$request) { throw new InvalidArgumentException("Request not found"); } + $mode = static::get_default_reading_mode(); // Check any pre-existing session mode