-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from e-spin/hotfix/fix_formdata_issue_11
Fix FORM_DATA
- Loading branch information
Showing
4 changed files
with
25 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
} | ||
], | ||
"require": { | ||
"php": "^8.1", | ||
"php": "^8.2", | ||
"contao/core-bundle": "^5.2" | ||
}, | ||
"require-dev": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,24 +3,30 @@ | |
/** | ||
* This file is part of e-spin/form-scr-default-bundle. | ||
* | ||
* Copyright (c) 2020-2024 e-spin | ||
* Copyright (c) 2020-2025 e-spin | ||
* | ||
* @package e-spin/form-scr-default-bundle | ||
* @author Ingolf Steinhardt <[email protected]> | ||
* @author Kamil Kuzminski <[email protected]> | ||
* @copyright 2020-2024 e-spin | ||
* @copyright 2020-2025 e-spin | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Espin\FormScrDefaultBundle\EventListener; | ||
|
||
use Contao\Form; | ||
use Contao\Input; | ||
use Contao\StringUtil; | ||
use Symfony\Component\HttpFoundation\RequestStack; | ||
|
||
class FormInsertTags | ||
{ | ||
public function __construct(private readonly RequestStack $requestStack) | ||
{ | ||
} | ||
|
||
/** | ||
* Replace the insert tags | ||
* | ||
|
@@ -33,9 +39,10 @@ public function replaceInsertTags(mixed $varTag): mixed | |
$arrTag = StringUtil::trimsplit('::', $varTag); | ||
|
||
if ($arrTag[0] === 'form_rawvalue') { | ||
return \is_array($_SESSION['FORM_DATA'][$arrTag[1]]) | ||
? \serialize($_SESSION['FORM_DATA'][$arrTag[1]]) | ||
: $_SESSION['FORM_DATA'][$arrTag[1]]; | ||
$formRawValue = $this->requestStack->getCurrentRequest()?->getSession() | ||
->get(Form::SESSION_KEY)?->getValue()[$arrTag[1]] ?? ''; | ||
|
||
return \is_array($formRawValue) ? \serialize($formRawValue) : $formRawValue; | ||
} | ||
|
||
if ($arrTag[0] === 'form_rawvalue_get') { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters