Extbase TYPO3 Adds JS Custom Library to Backend Module

I want to use custom JS libraries in extbase extension. Is it possible to use add_additional footer data api in the controller of the base module?

+4
source share
1 answer

Use viewhelper in a fluid template:

<f:be.container
  addJsFile = "{f:uri.resource(path:'js/script.js')}">
  <!-- Content -->
</f:be.container>


UPDATE:

As @biesior mentioned (thanks!), The method is addJsFiledeprecated. The following is an example of using the new and recommended be.container viewhelper method includeJsFiles. This new feature may include multiple JS files instead of one:

<f:be.container
 includeJsFiles = "{0:'{f:uri.resource(path: \'js/script1.js\')}', 1:'{f:uri.resource(path: \'js/script2.js\')}'}" >
  <!-- Content -->
</f:be.container>

See the relevant Fluid viewhelper Documentation .

+6
source

Source: https://habr.com/ru/post/1568279/


All Articles