jop-software / typo3-conf-js
TYPO3 view helper to load extension configuration in JavaScript
Installs: 166
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 3
Type:typo3-cms-extension
Requires
- php: >=8.1
- ext-json: *
- typo3/cms-core: ^11.5 || ^12.0
- typo3fluid/fluid: ^2.7
Requires (Dev)
- jop-software/testing-site-package: @dev
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.0
- rector/rector: 0.13.3
- squizlabs/php_codesniffer: ^3.6
- typo3/cms-tstemplate: ^11.5 || ^12.0
- typo3/minimal: ^v11.5 || ^v12.0
README
TYPO3 EXT:conf_js
Access your ext_conf in JavaScript
Professional Support
Professional support is available, please contact info@jop-software.de for more information.
Installation
Install this extension with composer.
composer require jop-software/typo3-conf-js
Usage
The extension provides a simple ViewHelper that generated a <script>
tag that makes the configuration available in
JavaScript.
The ViewHelper gets the extKey as an input, so you can control from which configuration you want to load the configuration.
Execute the ViewHelper in a fluid template
{namespace confJs=JopSoftware\TYPO3\ConfJs\ViewHelpers} <confJs:extensionConfiguration extKey="my_ext_key" />
And access the Configuration in JavaScript later
let configuration = window.extConf.get("my_ext_key");
You can also find an extension, implementing this behaviour for testing in
./Tests/Packages/testing-site-package
.
Security
Many times the extension configuration of an extension does contain secret information - like API Keys - that should not get exposed to the end user.
Currently, the extension always exports the entire extension configuration, but you can choose which extensions get exposed.
There already exists an issue (#4) about only exposing parts of the extension configuration, but this is not implemented at the moment.
Supported TYPO3 Versions
Local Development
We use DDEV for local development.
You get a complete ddev setup in this repository, just run ddev start
.
License
This project is licensed under GPL-2.0-or-later, see the LICENSE file for more information.