Skip to content

Commit 9f8978b

Browse files
author
Hans Höchtl
authored
Merge pull request #9 from simonschaufi/neos-8
Neos 8 Compatibility
2 parents 8476669 + 1d3f691 commit 9f8978b

File tree

8 files changed

+85
-79
lines changed

8 files changed

+85
-79
lines changed

Classes/Controller/AjaxFormController.php

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
namespace Onedrop\AjaxForm\Controller;
36

47
/* *
@@ -7,41 +10,30 @@
710
* */
811

912
use Neos\Flow\Annotations as Flow;
13+
use Neos\Flow\I18n\Exception\InvalidLocaleIdentifierException;
1014
use Neos\Flow\I18n\Locale;
15+
use Neos\Flow\I18n\Service;
1116
use Neos\Flow\Mvc\Controller\ActionController;
1217
use Neos\Flow\Security\Context;
1318

1419
class AjaxFormController extends ActionController
1520
{
1621
/**
22+
* @Flow\Inject
1723
* @var Context
1824
*/
19-
protected $securityContext;
25+
protected Context $securityContext;
2026

2127
/**
2228
* @Flow\Inject
23-
* @var \Neos\Flow\I18n\Service
24-
*/
25-
protected $i18nService;
26-
27-
/**
28-
* Injects the Security Context
29-
*
30-
* @param Context $securityContext
31-
* @return void
29+
* @var Service
3230
*/
33-
public function injectSecurityContext(Context $securityContext)
34-
{
35-
$this->securityContext = $securityContext;
36-
}
31+
protected Service $i18nService;
3732

3833
/**
39-
* @param string $formIdentifier
40-
* @param string $presetName
41-
* @param string $locale
42-
* @throws \Neos\Flow\I18n\Exception\InvalidLocaleIdentifierException
34+
* @throws InvalidLocaleIdentifierException
4335
*/
44-
public function indexAction($formIdentifier, $presetName, $locale = '')
36+
public function indexAction(string $formIdentifier, string $presetName, string $locale = ''): void
4537
{
4638
if (!empty($locale)) {
4739
$currentLocale = new Locale($locale);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
prototype(Onedrop.AjaxForm:Form) < prototype(Neos.NodeTypes.Form:Form) {
2+
sectionName = 'Content'
3+
templatePath = 'resource://Onedrop.AjaxForm/Private/Templates/NodeTypes/AjaxForm.html'
4+
5+
@context.formIdentifier = ${this.formIdentifier}
6+
@context.locale = ${node.context.dimensions.language[0]}
7+
@context.presetName = ${this.presetName}
8+
9+
formWrapperAttributes = Neos.Fusion:Attributes {
10+
data-ajax = 'ajax-form'
11+
data-ajax-uri = Neos.Fusion:UriBuilder {
12+
package = 'Onedrop.AjaxForm'
13+
controller = 'AjaxForm'
14+
action = 'index'
15+
format = 'html'
16+
arguments {
17+
locale = ${locale}
18+
formIdentifier = ${formIdentifier}
19+
presetName = ${presetName}
20+
}
21+
}
22+
}
23+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
prototype(Neos.Neos:Page) {
2+
body.javascripts.ajaxForms = Neos.Fusion:Tag {
3+
@position = '5100'
4+
tagName = 'script'
5+
attributes {
6+
src = Neos.Fusion:ResourceUri {
7+
path = 'resource://Onedrop.AjaxForm/Public/JavaScript/form.js'
8+
}
9+
}
10+
@if.hasFormAndIsLiveAndActive = ${q(node).children('[instanceof Neos.Neos:ContentCollection]').find('[instanceof Onedrop.AjaxForm:Form]').is() && node.context.live && Configuration.setting('Onedrop.AjaxForm.includeJavascript')}
11+
}
12+
}
Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,4 @@
1-
prototype(Onedrop.AjaxForm:Form) < prototype(Neos.NodeTypes.Form:Form) {
2-
sectionName = 'Content'
3-
templatePath = 'resource://Onedrop.AjaxForm/Private/Templates/NodeTypes/AjaxForm.html'
4-
5-
@context.formIdentifier = ${this.formIdentifier}
6-
@context.locale = ${node.context.dimensions.language[0]}
7-
@context.presetName = ${this.presetName}
8-
9-
formWrapperAttributes = Neos.Fusion:Attributes {
10-
data-ajax = 'ajax-form'
11-
data-ajax-uri = Neos.Fusion:UriBuilder {
12-
package = 'Onedrop.AjaxForm'
13-
controller = 'AjaxForm'
14-
action = 'index'
15-
format = 'html'
16-
arguments {
17-
locale = ${locale}
18-
formIdentifier = ${formIdentifier}
19-
presetName = ${presetName}
20-
}
21-
}
22-
}
23-
}
24-
25-
prototype(Neos.Neos:Page) {
26-
body.javascripts.ajaxForms = Neos.Fusion:Tag {
27-
@position = '5100'
28-
tagName = 'script'
29-
attributes {
30-
src = Neos.Fusion:ResourceUri {
31-
path = 'resource://Onedrop.AjaxForm/Public/JavaScript/form.js'
32-
}
33-
}
34-
@if.hasFormAndIsLiveAndActive = ${q(node).children('[instanceof Neos.Neos:ContentCollection]').find('[instanceof Onedrop.AjaxForm:Form]').is() && node.context.live && Configuration.setting('Onedrop.AjaxForm.includeJavascript')}
35-
}
36-
}
1+
/**
2+
* Root Fusion for the Onedrop.AjaxForm package
3+
*/
4+
include: ./**/*.fusion

Resources/Private/Templates/AjaxForm/Index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<!DOCTYPE html>
22
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
33
xmlns:f="http://typo3.org/ns/TYPO3Fluid/Fluid/ViewHelpers"
4-
xmlns:form="http://typo3.org/ns/Neos/Form/ViewHelpers">
4+
xmlns:form="http://typo3.org/ns/Neos/Form/ViewHelpers"
5+
data-namespace-typo3-fluid="true"
6+
>
57

68
<f:layout name="Default" />
79

@@ -11,7 +13,7 @@
1113
<form:render persistenceIdentifier="{formIdentifier}" presetName="{presetName}"/>
1214
</f:then>
1315
<f:else>
14-
<p>{f:translate(id: 'content.noValidFormIdentifier', package: 'Neos.NodeTypes', source: 'NodeTypes/Form')}</p>
16+
<p><f:translate id="content.noValidFormIdentifier" package="Neos.NodeTypes" source="NodeTypes/Form"/></p>
1517
</f:else>
1618
</f:if>
1719
</f:section>
Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
3-
<file original="" product-name="Onedrop.AjaxForm" source-language="en" datatype="plaintext" target-language="de">
4-
<body>
5-
<trans-unit id="ui.label" xml:space="preserve" approved="yes">
6-
<source>Ajax Form</source>
7-
<target xml:lang="de">Ajax Formular</target></trans-unit>
8-
<trans-unit id="groups.form" xml:space="preserve" approved="yes">
9-
<source>Form</source>
10-
<target xml:lang="de">Formular</target></trans-unit>
11-
<trans-unit id="properties.formIdentifier" xml:space="preserve" approved="yes">
12-
<source>Form Identifier</source>
13-
<target xml:lang="de">Formular-ID</target></trans-unit>
14-
<trans-unit id="properties.formIdentifier.selectBoxEditor.placeholder" xml:space="preserve" approved="yes">
15-
<source>Select the Form identifier</source>
16-
<target xml:lang="de">Formular-ID auswählen</target></trans-unit>
17-
</body>
18-
</file>
3+
<file original="" product-name="Onedrop.AjaxForm" source-language="en" datatype="plaintext" target-language="de">
4+
<body>
5+
<trans-unit id="ui.label" approved="yes">
6+
<source>Ajax Form</source>
7+
<target xml:lang="de">Ajax Formular</target>
8+
</trans-unit>
9+
<trans-unit id="groups.form" approved="yes">
10+
<source>Form</source>
11+
<target xml:lang="de">Formular</target>
12+
</trans-unit>
13+
<trans-unit id="properties.formIdentifier" approved="yes">
14+
<source>Form Identifier</source>
15+
<target xml:lang="de">Formular-ID</target>
16+
</trans-unit>
17+
<trans-unit id="properties.formIdentifier.selectBoxEditor.placeholder" approved="yes">
18+
<source>Select the Form identifier</source>
19+
<target xml:lang="de">Formular-ID auswählen</target>
20+
</trans-unit>
21+
</body>
22+
</file>
1923
</xliff>

Resources/Private/Translations/en/NodeTypes/Form.xlf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
33
<file original="" product-name="Onedrop.AjaxForm" source-language="en" datatype="plaintext">
44
<body>
5-
<trans-unit id="ui.label" xml:space="preserve">
5+
<trans-unit id="ui.label">
66
<source>Ajax Form</source>
77
</trans-unit>
8-
<trans-unit id="groups.form" xml:space="preserve">
8+
<trans-unit id="groups.form">
99
<source>Form</source>
1010
</trans-unit>
11-
<trans-unit id="properties.formIdentifier" xml:space="preserve">
11+
<trans-unit id="properties.formIdentifier">
1212
<source>Form Identifier</source>
1313
</trans-unit>
14-
<trans-unit id="properties.formIdentifier.selectBoxEditor.placeholder" xml:space="preserve">
14+
<trans-unit id="properties.formIdentifier.selectBoxEditor.placeholder">
1515
<source>Select the Form identifier</source>
1616
</trans-unit>
1717
</body>

composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"MIT"
77
],
88
"require": {
9-
"neos/neos": "~3.0 || ^4.0 || ^5.0 || ^7.0",
10-
"neos/nodetypes-form": "~3.0 || ^4.0 || ^5.0 || ^7.0"
9+
"neos/neos": "~3.0 || ^4.0 || ^5.0 || ^7.0 || ^8.0",
10+
"neos/nodetypes-form": "~3.0 || ^4.0 || ^5.0 || ^7.0 || ^8.0"
1111
},
1212
"autoload": {
1313
"psr-4": {
@@ -93,5 +93,10 @@
9393
"Neos.Neos-20180907103800",
9494
"Neos.Neos.Ui-20190319094900"
9595
]
96+
},
97+
"config": {
98+
"allow-plugins": {
99+
"neos/composer-plugin": true
100+
}
96101
}
97102
}

0 commit comments

Comments
 (0)