max-forter
(Max Forter)
December 16, 2016, 11:22am
1
Hello,
I am new to Neos/Flow and have a question, that the doku couldn’t tell me. I want to combine a property (e.g title) of all pages to an array. I have a ViewHelper where I could it perform via php, but I dont know how to build the ts2 to get the property from all pages.
I thought somethink like this:
allTitles = ${q(site).getAllPages().property('title')}
Thanks for your help
mficzel
(Martin Ficzel)
December 16, 2016, 7:19pm
2
In Neos 3.0 this will become easy:
allTitles = Neos.Fusion:RawCollection {
collection = ${q(site).find('[instanceof Neos.Neos:Document]').get()}
itemName = 'item'
itemRenderer = ${q(item).property('title')}
}
For Neos2.3 i suggest to create a custom FlowQuery operation. See http://neos.readthedocs.io/en/stable/ExtendingNeos/CustomFlowQueryOperations.html
max-forter
(Max Forter)
December 20, 2016, 1:59pm
3
Hallo martoro,
Thank you for your answer. Instead of the FlowQuery operation I used the nodeSearchService:
$this->context = $this->contextFactory->create(array('workspaceName' => 'live'));
$allNodes = $this->nodeSearchService->findByProperties('title', array('TYPO3.Neos.NodeTypes:Page'), $this->context);
foreach ($allNodes as $node){
echo $node->getProperty('title');
}
Works fine. Looking forward to version 3.
1 Like
mficzel
(Martin Ficzel)
December 20, 2016, 3:45pm
4
Ahh … you are already in php. I just thought about fusion. Nice that you got it working.