[Neos] Rewrite of f:link.action

Bastian Waidelich bastian at typo3.org
Mon Apr 7 19:46:13 CEST 2014


Carsten Bleicker wrote:

Hi Carsten,

Thanks for posting this to the mailing list ;)

> BasketController->simpleAction() should be available on any page. so i query its pluginView by ts and push it into the page.
>
> so i do:
> page = Page {
> 	parts{
> 		simpleBasket = PIPEU.Site:SimpleBasket{
> 			node = ${q(site).find('simplebasket').children('main').filter('[instanceof TYPO3.Neos:PluginView]').first()}
> 		}
> 	}
> }

I'm not into FlowQuery yet, but with the help of my fellow team mates I 
could spot some errors in that expression:

With "children('main').filter('[instanceof TYPO3.Neos:PluginView]')" you 
apply a filter to the "main" node only, not to its child nodes

The ".first()" returns an array (I only learned that today). What you 
need is "get(0)".


Frankly, even though this is consistent and in sync with jQuery, it's 
currently quite hard to get it right without proper debugging tools. I'm 
confident this will change soon, and there are already some really nice 
ideas and prototypes for better tooling support floating around.

But there's yet another issue:
I tried to reproduce the use case with the demo site:

page.body.parts.flickrStream = TYPO3.NeosDemoTypo3Org:Flickr {
   tags = 'TYPO3'
   node = 
${q(site).find('features/plugins/user-photo-stream/main').children('[instanceof 
TYPO3.Neos:PluginView]').get(0)}
}

But this breaks rendering because the PluginService then fails to find 
the master plugin. Instead you have to specify the node of the master 
plugin that contains your "ExtendedBasket". For the demo site this would be:

page.body.parts.flickrStream = TYPO3.NeosDemoTypo3Org:Flickr {
   tags = 'TYPO3'
   node = ${q(site).find('features/plugins/main').children('[instanceof 
TYPO3.NeosDemoTypo3Org:Flickr]').get(0)}
}

HTH
-- 
Bastian Waidelich


More information about the Neos mailing list