Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to link local/extension script-files via inject()? #333

Closed
Moongazer opened this issue Apr 25, 2024 · 1 comment
Closed

Comments

@Moongazer
Copy link

Moongazer commented Apr 25, 2024

Feature Request

Not sure if this is possible already, that's why I open it as feature-request here (at least it seems not documented): It would be really great if there is a way to link local/extension script-files in TypoScript inject() object. For example, not all script are always remote on servers at Google, Facebook, etc... Or even if they are, sometimes it is useful to create a wrapper around such tracking-scripts e.g. to mock function calls to fbc().

So if these scripts are stored in a local extension, how can we link them to be loaded dynamically? Hardcoding the following path might work until v11, but I think starting from v12 where the assets directory are generated dynamically by hash-folder names, this will not work anymore. If possible the common TYPO3 approach like EXT:my_ext/Resources/Public/Js/custom.js would be better to create an absolute URL:

plugin.tx_cookieman {
  settings {
    trackingObjects {
      MyCustomSolution {
        inject (
<script src="/typo3conf/ext/my_ext/Resources/Public/Js/custom.js"></script>
        )
      }
    }
  }
}

Any ideas on that matter? Appreciate your feedback 🙂

@jonaseberle
Copy link
Member

That was our primary headache for v12 compatibility ;)

See the PR #323 and the changes of that PR in the documentation for how we approached it.

Basically inject will be a cObject.

But we don't plan to backport that to v11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants