diff --git a/Classes/Controller/AjaxFormController.php b/Classes/Controller/AjaxFormController.php index 9793d40..93b5866 100644 --- a/Classes/Controller/AjaxFormController.php +++ b/Classes/Controller/AjaxFormController.php @@ -1,4 +1,7 @@ securityContext = $securityContext; - } + protected Service $i18nService; /** - * @param string $formIdentifier - * @param string $presetName - * @param string $locale - * @throws \Neos\Flow\I18n\Exception\InvalidLocaleIdentifierException + * @throws InvalidLocaleIdentifierException */ - public function indexAction($formIdentifier, $presetName, $locale = '') + public function indexAction(string $formIdentifier, string $presetName, string $locale = ''): void { if (!empty($locale)) { $currentLocale = new Locale($locale); diff --git a/Resources/Private/Fusion/Content/Form.fusion b/Resources/Private/Fusion/Content/Form.fusion new file mode 100644 index 0000000..07e713e --- /dev/null +++ b/Resources/Private/Fusion/Content/Form.fusion @@ -0,0 +1,23 @@ +prototype(Onedrop.AjaxForm:Form) < prototype(Neos.NodeTypes.Form:Form) { + sectionName = 'Content' + templatePath = 'resource://Onedrop.AjaxForm/Private/Templates/NodeTypes/AjaxForm.html' + + @context.formIdentifier = ${this.formIdentifier} + @context.locale = ${node.context.dimensions.language[0]} + @context.presetName = ${this.presetName} + + formWrapperAttributes = Neos.Fusion:Attributes { + data-ajax = 'ajax-form' + data-ajax-uri = Neos.Fusion:UriBuilder { + package = 'Onedrop.AjaxForm' + controller = 'AjaxForm' + action = 'index' + format = 'html' + arguments { + locale = ${locale} + formIdentifier = ${formIdentifier} + presetName = ${presetName} + } + } + } +} diff --git a/Resources/Private/Fusion/Override/Page.fusion b/Resources/Private/Fusion/Override/Page.fusion new file mode 100644 index 0000000..e62e126 --- /dev/null +++ b/Resources/Private/Fusion/Override/Page.fusion @@ -0,0 +1,12 @@ +prototype(Neos.Neos:Page) { + body.javascripts.ajaxForms = Neos.Fusion:Tag { + @position = '5100' + tagName = 'script' + attributes { + src = Neos.Fusion:ResourceUri { + path = 'resource://Onedrop.AjaxForm/Public/JavaScript/form.js' + } + } + @if.hasFormAndIsLiveAndActive = ${q(node).children('[instanceof Neos.Neos:ContentCollection]').find('[instanceof Onedrop.AjaxForm:Form]').is() && node.context.live && Configuration.setting('Onedrop.AjaxForm.includeJavascript')} + } +} diff --git a/Resources/Private/Fusion/Root.fusion b/Resources/Private/Fusion/Root.fusion index 26c6b58..eec2d8e 100644 --- a/Resources/Private/Fusion/Root.fusion +++ b/Resources/Private/Fusion/Root.fusion @@ -1,36 +1,4 @@ -prototype(Onedrop.AjaxForm:Form) < prototype(Neos.NodeTypes.Form:Form) { - sectionName = 'Content' - templatePath = 'resource://Onedrop.AjaxForm/Private/Templates/NodeTypes/AjaxForm.html' - - @context.formIdentifier = ${this.formIdentifier} - @context.locale = ${node.context.dimensions.language[0]} - @context.presetName = ${this.presetName} - - formWrapperAttributes = Neos.Fusion:Attributes { - data-ajax = 'ajax-form' - data-ajax-uri = Neos.Fusion:UriBuilder { - package = 'Onedrop.AjaxForm' - controller = 'AjaxForm' - action = 'index' - format = 'html' - arguments { - locale = ${locale} - formIdentifier = ${formIdentifier} - presetName = ${presetName} - } - } - } -} - -prototype(Neos.Neos:Page) { - body.javascripts.ajaxForms = Neos.Fusion:Tag { - @position = '5100' - tagName = 'script' - attributes { - src = Neos.Fusion:ResourceUri { - path = 'resource://Onedrop.AjaxForm/Public/JavaScript/form.js' - } - } - @if.hasFormAndIsLiveAndActive = ${q(node).children('[instanceof Neos.Neos:ContentCollection]').find('[instanceof Onedrop.AjaxForm:Form]').is() && node.context.live && Configuration.setting('Onedrop.AjaxForm.includeJavascript')} - } -} +/** + * Root Fusion for the Onedrop.AjaxForm package + */ +include: ./**/*.fusion diff --git a/Resources/Private/Templates/AjaxForm/Index.html b/Resources/Private/Templates/AjaxForm/Index.html index 2b95e9b..78893f0 100644 --- a/Resources/Private/Templates/AjaxForm/Index.html +++ b/Resources/Private/Templates/AjaxForm/Index.html @@ -1,7 +1,9 @@ + xmlns:form="http://typo3.org/ns/Neos/Form/ViewHelpers" + data-namespace-typo3-fluid="true" +> @@ -11,7 +13,7 @@ -

{f:translate(id: 'content.noValidFormIdentifier', package: 'Neos.NodeTypes', source: 'NodeTypes/Form')}

+

diff --git a/Resources/Private/Translations/de/NodeTypes/Form.xlf b/Resources/Private/Translations/de/NodeTypes/Form.xlf index 744c155..86d1851 100644 --- a/Resources/Private/Translations/de/NodeTypes/Form.xlf +++ b/Resources/Private/Translations/de/NodeTypes/Form.xlf @@ -1,19 +1,23 @@ - - - - Ajax Form - Ajax Formular - - Form - Formular - - Form Identifier - Formular-ID - - Select the Form identifier - Formular-ID auswählen - - + + + + Ajax Form + Ajax Formular + + + Form + Formular + + + Form Identifier + Formular-ID + + + Select the Form identifier + Formular-ID auswählen + + + diff --git a/Resources/Private/Translations/en/NodeTypes/Form.xlf b/Resources/Private/Translations/en/NodeTypes/Form.xlf index 5330f44..66bf45e 100644 --- a/Resources/Private/Translations/en/NodeTypes/Form.xlf +++ b/Resources/Private/Translations/en/NodeTypes/Form.xlf @@ -2,16 +2,16 @@ - + Ajax Form - + Form - + Form Identifier - + Select the Form identifier diff --git a/composer.json b/composer.json index 59949a5..c7909e7 100644 --- a/composer.json +++ b/composer.json @@ -6,8 +6,8 @@ "MIT" ], "require": { - "neos/neos": "~3.0 || ^4.0 || ^5.0 || ^7.0", - "neos/nodetypes-form": "~3.0 || ^4.0 || ^5.0 || ^7.0" + "neos/neos": "~3.0 || ^4.0 || ^5.0 || ^7.0 || ^8.0", + "neos/nodetypes-form": "~3.0 || ^4.0 || ^5.0 || ^7.0 || ^8.0" }, "autoload": { "psr-4": { @@ -93,5 +93,10 @@ "Neos.Neos-20180907103800", "Neos.Neos.Ui-20190319094900" ] + }, + "config": { + "allow-plugins": { + "neos/composer-plugin": true + } } }