TYPO3:在后端添加一个javascript模块?



我尝试添加一个自定义表单元素,并按照本教程进行操作:https://gist.github.com/manuelselbach/dc63abd313694c594d480b163a5f3053

除了JS模块部分之外,一切都有效。每次我尝试加载表单时,我都会收到一个 404 错误,即找不到模块,我真的不知道为什么或如何将其添加到我的后端。

我的文件夹结构如下所示:

typo3conf
ext
tjms
Configuration
Form
CustomFormSetup.yaml
FormEditorSetup.yaml
Resources
Public
js
TjmsTabsViewModel.js

在我的FormEditorSetup.yaml中,我添加了这个yaml代码:

TYPO3:
CMS:
Form:
prototypes:
standard:
formEditor:
dynamicRequireJsModules:
additionalViewModelModules:
1588750194: "/TYPO3/CMS/tjms/TjmsTabsViewModel"
formEditorPartials:
FormElement-TjmsTabs: "Stage/SimpleTemplate"
formElementsDefinition:
TjmsTabs:
formEditor:
label: "formEditor.elements.TjmsTabs.label"
group: custom
groupSorting: 1000
iconIdentifier: "form-multi-checkbox"
mixins:
formElementMixins:
TjmsTabsMixin:
__inheritances:
10: "TYPO3.CMS.Form.mixins.formElementMixins.FormElementMixin"

My CustomFormSetup.yaml:

TYPO3:
CMS:
Form:
persistenceManager:
allowedExtensionPaths:
100: EXT:tjms/Resources/Private/Forms/
allowSaveToExtensionPaths: true
allowDeleteFromExtensionPaths: true
prototypes:
standard:
formElementsDefinition:
Form:
renderingOptions:
templateRootPaths:
100: "EXT:tjms/Resources/Private/Forms/Templates/"
partialRootPaths:
100: "EXT:tjms/Resources/Private/Forms/Partials/"
layoutRootPaths:
100: "EXT:tjms/Resources/Private/Forms/Layouts/"
formEditor:
formEditorPartials:
FormElement-TjmsTabs: "Stage/SimpleTemplate"
TjmsTabs:
__inheritances:
10: "TYPO3.CMS.Form.mixins.formElementMixins.TjmsTabsMixin"
mixins:
formElementMixins:
TjmsTabsMixin:
__inheritances:
10: "TYPO3.CMS.Form.mixins.formElementMixins.FormElementMixin"

我已经在我的插件和模块中包含 yaml 文件。但是每次我进入我的后端>表格>我的测试表格时,我都会收到错误:

GET http://localhost/TYPO3/CMS/tjms/Backend/FormEditor/TjmsTabsViewModel?bust=d0e6c9adcc1da3f6a39dbdc7b27b9817bcb662c5 net::ERR_ABORTED 404 (Not Found)
VM20251 require.js:1 Uncaught Error: Script error for "/TYPO3/CMS/tjms/Backend/FormEditor/TjmsTabsViewModel"
http://requirejs.org/docs/errors.html#scripterror
at makeError (require.js:1)
at HTMLScriptElement.onScriptError (require.js:1)

有人知道为什么它不起作用吗?

我在码头工人设置中使用 TYPO3 版本9.5.18

感谢您的任何帮助!

这篇博客文章帮助我解决了这个问题:

http://labor.99grad.de/typo3-tx_form-eigenes-formularelement-erstellen-custom-form-element/

最新更新