A “source” page (TestimonialPage) with a ContentCollection that holds a custom TeaserElement, and
a “destination” page with a LinkEditor, to choose the sourcePage.
The link goes to the page property: testimonial. That works fine.
Both pages have the same ContentCollection (teaserCollection).
The aim is to render the Teaser from the source page into the ContentCollection of the destination page.
Maybe you will find the magic lines in follow :
Works well for me. Maybe you will find one or two possible improvements here and there.
#NodeTypes.MixinSmarterLink.yaml
#Use it within other NodeTypes with
#superTypes:
# ' Vendor.Site:MixinSmarterLink' = TRUE
### MixinSmarterLink
'Vendor.Site:MixinSmarterLink':
abstract: TRUE
superTypes:
'TYPO3.Neos:Content': TRUE
ui:
inspector:
groups:
yourGroupName:
label: yourGroupName
position: 4
properties:
link:
type: string
ui:
label: 'Link zu anderem Element/Node'
help:
message: "NodeElement zu dem ein Link erstellt werden soll."
inspector:
group: 'yourGroupName'
editor: 'TYPO3.Neos/Inspector/Editors/LinkEditor'
editorOptions:
placeholder: 'Link direkt einfügen, oder nach Node suchen'
position: 103
#SmarterCollector.ts2
### SmarterCollector to use nodeContent in other Neos-places
prototype(Vendor.Site:SmarterCollector) < prototype(TYPO3.Neos:Content) {
CCRenderer = TYPO3.Neos:ContentCollectionRenderer
linkedNode = ${q(node).property('link')}
linkedNode.@process.removeProtocolPrefix = ${String.pregReplace(value, "/node:\/\//" , '')}
linkedNode.@process.findByIdentifier = ${q(node).find('#' + value)}
linkedNode.@process.getContainer = ${value.children('container').get(0)}
}
I’m quite sure there are NO tools or other things [quote=“energyWinner, post:1, topic:1262”]
to debug (print, echo …) TypoScript / Eel
[/quote]
, except your known <f:debug>{whatIsInThisProperty}</f:debug>
Because I ask for this a few times in Forum and somewhere else. Nowhere I got an answer …
Hi Klaus,
the «MixinSmarterLink» NodeType is only the abstraction Layer I use.
With change in first and last Line I wrote above - I guess, you don’t have to use my MixinSmarterLink.yaml.
So you can use your direct declared property «teaserCollection» or the «destination» (
In the end, just the property with LinkEditor defined) from:[quote=“energyWinner, post:1, topic:1262”]
2. a “destination” page with a LinkEditor, to choose the sourcePage.
[/quote]
My code and the Mixin is only a copy & paste from working code.
the findByINdentifier call an find() with «#» in front of the identifierHash.
the getContainer/getTeaserCollection only go to children with this pathName.
###Debug
I will give a try, but at first glance your code could be the almost same like:
#.ts2-file
value = ${q(node).children('teasercollection').property('_path')}
#fluidTemplate-file
<f:debug title="valueFrom_teaserCollection_Path">{value}</f:debug>
If no big different: This code would be easier to read, I think. But I have to tryout the differences first.
Same nice and sunny weekend for you!
Later on…
Now I see: Maybe It’s the different places, we use our code.
You in page TS-Object [quote=“energyWinner, post:4, topic:1262”]
Put this inside your page TS-Object
[/quote]
I use it in the Prototype from SmarterCollector…
thank you for detailed explanaition. I will implement it on monday morning!
I just don’t thought, it would be neccessary to convert such things by hand.
If you are going to link to internal pages only, using the reference type is preferred as it gives you the node directly (which can then be used in the template with the link.node VH). If you use the link editor to create arbitrary links the easiest way to convert them is:
Sound counterintuitive, but the property operation used in q(node).property('internalLink') will return the raw value (a node) and no longer a FlowQuery object so in the second try (with get(0)) that can be skipped. And for using the children operation you need to wrap that again in FlowQuery like this q(q(node).property('internalLink')).children('container').get(0) to get the child node “container” from your internalLink node.
@christianm
Thanks, works good. And I know the counterintuitive (I guess). But I use it in the NeedMoreSpeed situation.
With «find the children» I concat the value in the «container»-Node only. So I can display this separated nodes in the Backend-Editing-Area (each root-node) correctly.
On the other hand the needed div-wrapper I use for (display nodes split in Backend), does not harm the layout in the resulting frontend-output …
I know it sounds complicated and counterintuitive but I can’t find an other working and passably-speedy solution.
If you see a simplification in logic or solution-implementation, I very welcome hints and suggestions.