[Neos] Wrapping *each* children of ContentCollection with custom markup

Marcin Ryzycki marcin at ryzycki.com
Fri Apr 18 15:34:13 CEST 2014


On 2014-04-17 06:09:16 am +0000, Pankaj Lele said:

> try this one
> 
> prototype(M12.Foundation:BlockGrid) < prototype(M12.Foundation:Content) {
> 	blockGridContent = TYPO3.TypoScript:Collection {
> 		collection = ${q(node).children('[instanceof 
> TYPO3.Neos:ContentCollection]').children()}
> 		itemName = 'gridItem'
> 		itemRenderer = TYPO3.Neos:ContentCase
> 	}
> }

Hi Pankaj,

Sorry for late reply. The above code causes Neos being unresponsive for 
a minute or so (and CPU load on the server = 100%), and then results 
with

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to 
allocate 25947 bytes) in 
Packages/Application/TYPO3.TypoScript/Classes/TYPO3/TypoScript/TypoScriptObjects/AbstractTypoScriptObject.php 
on line 77

Line 77 is the line with tsRuntime->evaluate() in that function:
protected function tsValue($path) {
	$fullPath = $this->path . '/' . $path;
	if (!isset($this->tsValueCache[$fullPath])) {
		$this->tsValueCache[$fullPath] = 
$this->tsRuntime->evaluate($fullPath, $this);
	}
	return $this->tsValueCache[$fullPath];
}


Anyway, I tried more complex code in addition to yours:

blockGridContent = TYPO3.TypoScript:Collection {
	collection = ${q(node).children('[instanceof 
TYPO3.Neos:ContentCollection]').children()}
	itemName = 'gridItem'
	itemRenderer = TYPO3.Neos:ContentCase {
		default {
			type = 'M12.Foundation:BlockGridItem'
		}
	}
}
prototype(M12.Foundation:BlockGridItem) < prototype(M12.Foundation:Content) {
	node = ${gridItem}
	blockGridItemContent = TYPO3.Neos:ContentCollection {
		nodePath = '.'
	}
}


it *almost* worked...
<ts:render path="blockGridItemContent" /> inside BlockGridItem.html now 
renders content, but each item is rendered with the whole original 
content from blockGridContent (so if there were 3 items, I have all of 
them 3 times, wrapped in BlockGridItem markup. Not exacly what I neeed 
;-)

Any other guidelines? Thanks in advance.

M.



More information about the Neos mailing list