Skip to content

Commit 8e91dbc

Browse files
committed
Update: Use @Private in fusion
1 parent 58511ca commit 8e91dbc

File tree

5 files changed

+44
-44
lines changed

5 files changed

+44
-44
lines changed

Resources/Private/Fusion/Component/Countries.fusion

+27-29
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
prototype(Garagist.Mautic:Countries) < prototype(Neos.Fusion:Component) {
2+
value = null
3+
24
countries = Neos.Fusion:DataStructure {
35
europe {
46
label = 'Europe'
@@ -263,36 +265,32 @@ prototype(Garagist.Mautic:Countries) < prototype(Neos.Fusion:Component) {
263265
}
264266
}
265267

266-
value = null
267-
268-
renderer = Neos.Fusion:Component {
269-
_translatedCountries = Neos.Fusion:Map {
270-
@process.filter = ${Array.filter(value)}
271-
items = ${props.countries}
272-
itemRenderer = Neos.Fusion:DataStructure {
273-
@if.hasCountries = ${Carbon.Array.check(item.items)}
274-
label = ${Translation.translate(itemKey, item.label, [], 'Countries', 'Garagist.Mautic')}
275-
items = Neos.Fusion:Map {
276-
items = ${item.items}
277-
keyRenderer = ${itemKey}
278-
itemRenderer = ${Translation.translate(itemKey, item, [], 'Countries', 'Garagist.Mautic')}
279-
}
268+
@private.translatedCountries = Neos.Fusion:Map {
269+
@process.filter = ${Array.filter(value)}
270+
items = ${props.countries}
271+
itemRenderer = Neos.Fusion:DataStructure {
272+
@if.hasCountries = ${Carbon.Array.check(item.items)}
273+
label = ${Translation.translate(itemKey, item.label, [], 'Countries', 'Garagist.Mautic')}
274+
items = Neos.Fusion:Map {
275+
items = ${item.items}
276+
keyRenderer = ${itemKey}
277+
itemRenderer = ${Translation.translate(itemKey, item, [], 'Countries', 'Garagist.Mautic')}
280278
}
281279
}
282-
283-
renderer = afx`
284-
<Neos.Fusion:Loop items={props._translatedCountries}>
285-
<optgroup label={item.label}>
286-
<Neos.Fusion:Loop items={Array.sort(item.items)}>
287-
<option
288-
value={itemKey}
289-
selected={itemKey == props.value}
290-
>
291-
{item}
292-
</option>
293-
</Neos.Fusion:Loop>
294-
</optgroup>
295-
</Neos.Fusion:Loop>
296-
`
297280
}
281+
282+
renderer = afx`
283+
<Neos.Fusion:Loop items={private.translatedCountries}>
284+
<optgroup label={item.label}>
285+
<Neos.Fusion:Loop items={Array.sort(item.items)}>
286+
<option
287+
value={itemKey}
288+
selected={itemKey == props.value}
289+
>
290+
{item}
291+
</option>
292+
</Neos.Fusion:Loop>
293+
</optgroup>
294+
</Neos.Fusion:Loop>
295+
`
298296
}

Resources/Private/Fusion/Component/Form/Fragment/API.fusion

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ prototype(Garagist.Mautic:Component.Form.Fragment.API) < prototype(Neos.Fusion:C
1111
class = null
1212
renderPrototype = ${Configuration.Setting('Garagist.Mautic.apiRenderer')}
1313

14-
@if.hasUrl_Id = ${this.url && this.id && this.renderPrototype}
14+
@if.hasUrlId = ${this.url && this.id && this.renderPrototype}
1515

1616
renderer = Neos.Fusion:Renderer {
1717
type = ${props.renderPrototype}

Resources/Private/Fusion/Component/Form/Fragment/Iframe.fusion

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ prototype(Garagist.Mautic:Component.Form.Fragment.Iframe) < prototype(Neos.Fusio
99
url = null
1010
class = ${this.iframeClass}
1111

12-
@if.hasUrl_Id = ${this.url && this.id}
12+
@if.hasUrlId = ${this.url && this.id}
1313

1414
renderer = afx`
1515
<iframe src={props.url + "/form/" + props.id} class={props.class}></iframe>

Resources/Private/Fusion/Component/Form/Fragment/Javascript.fusion

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ prototype(Garagist.Mautic:Component.Form.Fragment.Javascript) < prototype(Neos.F
77
id = null
88
url = null
99

10-
@if.hasUrl_Id = ${this.url && this.id}
10+
@if.hasUrlId = ${this.url && this.id}
1111

1212
renderer = afx`
1313
<script type="text/javascript" src={props.url + "/form/generate.js?id=" + props.id} defer></script>

Resources/Private/Fusion/Component/Form/Fragment/Plain.fusion

+14-12
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,29 @@ prototype(Garagist.Mautic:Component.Form.Fragment.Plain) < prototype(Neos.Fusion
1313
apiUrl = null
1414
removeStyles = true
1515

16-
@if.hasUrl_Id_ApiUrl = ${this.url && this.id && this.apiUrl}
16+
@if.hasUrlIdApiUrl = ${this.url && this.id && this.apiUrl}
1717

18-
_javascript = ${this.url + '/media/js/mautic-form.js'}
19-
_embededFile = ${File.readFile(this.apiUrl + "/form/embed/" + this.id)}
20-
[email protected] = ${this.removeStyles && value ? String.pregReplace(value, '~<style([.\s\S]*?)</style>~', ''): value}
21-
_hasReplacements = ${Carbon.Array.check(this.replacements)}
22-
_globalVariables = ${'window.MauticDomain="' + this.url + '";window.MauticLang={submittingMessage:"' + this.waitMessage + '"}'}
18+
@private {
19+
javascript = ${props.url + '/media/js/mautic-form.js'}
20+
embededFile = ${File.readFile(props.apiUrl + "/form/embed/" + props.id)}
21+
[email protected] = ${props.removeStyles && value ? String.pregReplace(value, '~<style([.\s\S]*?)</style>~', ''): value}
22+
hasReplacements = ${Carbon.Array.check(props.replacements)}
23+
globalVariables = ${'window.MauticDomain="' + props.url + '";window.MauticLang={submittingMessage:"' + props.waitMessage + '"}'}
24+
}
2325

2426
renderer = afx`
25-
<script data-slipstream>{props._globalVariables}</script>
26-
<script src={props._javascript} data-slipstream defer onload="MauticSDK.onLoad()"></script>
27-
{props._hasReplacements ? '' : props._embededFile}
27+
<script data-slipstream>{private.globalVariables}</script>
28+
<script src={private.javascript} data-slipstream defer onload="MauticSDK.onLoad()"></script>
29+
{private.hasReplacements ? '' : private.embededFile}
2830
<Neos.Fusion:Reduce
29-
@if={props._hasReplacements}
31+
@if={private.hasReplacements}
3032
items={props.replacements}
31-
initialValue={props._embededFile}
33+
initialValue={private.embededFile}
3234
itemReducer={String.replace(carry, item.search, item.replace)}
3335
/>
3436
`
3537

36-
@context.cacheEntryIdentifier = ${'MauticFormPlain'+ this.url + this.id + this.apiUrl}
38+
@context.cacheEntryIdentifier = ${'MauticFormPlain' + this.url + this.id + this.apiUrl}
3739

3840
@cache {
3941
mode = 'cached'

0 commit comments

Comments
 (0)