contao / core-bundle

[READ-ONLY] Contao Core Bundle
GNU Lesser General Public License v3.0
123 stars 58 forks source link

Insert-Tag {{session::*}} #1704

Closed syntaxys closed 4 years ago

syntaxys commented 4 years ago

Description
For pre-filling a form with auto-generated content I used in Contao 3 the extension inputvar which unfortunately is orphaned. Writing and publishing an extension for that purpose would be a lot more to do …

Would it be a big deal to add some lines to core-bundle/src/Resources/contao/library/Contao/InsertTags.php for handling session stored data in the frontend in an easy way like with {{post::*}}? I've added these 4 lines up from line 576 which served my needs:

Example

// SESSION data
case 'session':
    $arrCache[$strTag] = $this->Session->get($elements[1]);
    break;
leofeyer commented 4 years ago

The {{post}} insert tag already accesses $_SESSION['FORM_DATA'] if the request is not a POST request. Maybe you can use this in your installation?