/**
* @return void
* @internal
*/
protected function initializeCurrentPageFromRequest()
{
if (!$this->formState->isFormSubmitted()) {
$this->currentPage = $this->formDefinition->getPageByIndex(0);
return;
}
$this->lastDisplayedPage = $this->formDefinition->getPageByIndex($this->formState->getLastDisplayedPageIndex());
// We know now that lastDisplayedPage is filled
$currentPageIndex = (int) $this->request->getInternalArgument('__currentPage');
if ($currentPageIndex > $this->lastDisplayedPage->getIndex() + 1) {
// We only allow jumps to following pages
$currentPageIndex = $this->lastDisplayedPage->getIndex() + 1;
}
// We now know that the user did not try to skip a page
if ($currentPageIndex === count($this->formDefinition->getPages())) {
// Last Page
$this->currentPage = null;
} else {
$this->currentPage = $this->formDefinition->getPageByIndex($currentPageIndex);
}
}