pixelant / recall
TYPO3 extension that remembers settings from a different request using a hash. E.g. recall settings or data used in the main request within an eID request.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 6
Forks: 0
Open Issues: 0
Type:typo3-cms-extension
Requires
- php: ~7.2.0 || ~7.3.0 || ~7.4.0
- typo3/cms-core: ^9.5 || ^10.4
Requires (Dev)
- codeception/codeception: ^4.1.5
- helhum/typo3-composer-setup: ^0.5.7
- nimut/testing-framework: ^5.0.3
- phpunit/phpunit: ^7.5.20
- seld/jsonlint: ^1.8
- typo3/cms-fluid-styled-content: ^9.5 || ^10.4
This package is auto-updated.
Last update: 2024-11-08 15:52:18 UTC
README
TYPO3 extension that can remember settings from a different request using a hash. E.g. recalling settings or data used in the main request within an eID request.
Installation
- Install the extension using Composer:
composer req pixelant/recall
- Activate the extension in TYPO3 by using the Admin Tools > Extensions module or by running
vendor/bin/typo3 extension:activate recall; vendor/bin/typo3cms database:updateschema
in the command line.
Usage
Initializing recallable data in a normal controller class:
// use Pixelant\Recall\Service\RecallService // use TYPO3\CMS\Core\Page\PageRenderer $recallService = GeneralUtility::makeInstance(RecallService::class); $recallHash = $recallService->set(['settings' => $this->settings]); $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->addInlineSettingArray( 'tx_myextension', ['recallHash' => $recallHash] );
Make an Ajax call to fetch data using eID:
$.ajax( '/?eID=tx_myextension_getmore&recall=' + TYPO3.settings.tx_myextension.recallHash );
Handle the eID in a Controller. (Note that eID controllers do not initialize a settings array.)
$recallHash = $request->getQueryParams()['recall']; $settings = $this->recallService->get($recallHash)['settings'];
You now have access to the settings from the original request without having to initialize configuration or think about page IDs.
Tip: You can of course also supply less information than the entire settings array.
Clean Up
The recall data is stored in the database, and the hash is unique for the data. If you change your data a lot, you'll quickly fill up the database.
Run the cleanup command frequently (or set up a Scheduler task):
vendor/bin/typo3 recall:cleanup
Help screen:
Description:
Removes old recall data.
Usage:
recall:cleanup [<age>]
Arguments:
age The minimum age of records to remove. Default is sessionTimeout or 86400 seconds. [default: 6000]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Removes recall data older than [age] seconds. The default age is the same as $GLOBALS['TYPO3_CONF_VARS']['FE']['sessionTimeout'] or (if that's not set) 86400 seconds.
Please note: The timestamp for each recall data record is updated each time it is requested, so frequently-used records won't be deleted.
Bugs, contribution, and feature requests
Bug reports, pull requests, and feature requests are very welcome. Create a bug report or feature request