Skip to content

Commit

Permalink
Set current page in Director for using $LinkingMode in template
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Hutchinson committed Sep 8, 2019
1 parent d5faf40 commit 510c3fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/controllers/PartialUserFormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Page;
use SilverStripe\Control\HTTPRequest;
use Firesphere\PartialUserforms\Forms\PasswordForm;
use SilverStripe\Control\Director;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Control\HTTPResponse_Exception;
use SilverStripe\Control\Middleware\HTTPCacheControlMiddleware;
Expand Down Expand Up @@ -56,10 +57,12 @@ public function partial(HTTPRequest $request)
$controller = parent::create($record);
$controller->doInit();

Director::set_current_page($controller->data());

// Set the session after init and check if the last session has expired
// or another submission has started
$sessionID = $request->getSession()->get(PartialSubmissionController::SESSION_KEY);
if (!$sessionID || $sessionID !== $partial->ID) {
if (!$sessionID || $sessionID !== $partial->ID) {
$request->getSession()->set(PartialSubmissionController::SESSION_KEY, $partial->ID);
}

Expand Down

0 comments on commit 510c3fb

Please sign in to comment.