@@ -338,6 +338,64 @@ Flowpack:
338338This is needed so that the system knows which keys should be synchronized between the different content stores,
339339and what data to delete if a release is removed.
340340
341+ # ## Rendering additional nodes with arguments (e.g. pagination or filters)
342+
343+ If you render a paginated list or have filters (with a predictable list of values) that can be
344+ added to a document via arguments, you can implement a slot for the `nodeEnumerated` signal to enumerate additional
345+ nodes with arguments.
346+
347+ > **Note:** Request arguments must be mapped to URIs via custom routes, since we do not support HTTP query parameters for rendered documents.
348+
349+ # ### Example
350+
351+ Add a slot for the `nodeEnumerated` signal via `Package.php` :
352+
353+ ` ` ` php
354+ <?php
355+ class Package extends BasePackage
356+ {
357+ public function boot(Bootstrap $bootstrap)
358+ {
359+ $dispatcher = $bootstrap->getSignalSlotDispatcher();
360+
361+ $dispatcher->connect(NodeEnumerator::class, 'nodeEnumerated', MyNodeListsEnumerator::class, 'enumerateNodeLists');
362+ }
363+ }
364+ ` ` `
365+
366+ Implement the slot and enumerate additional nodes depending on the node type :
367+
368+ ` ` ` php
369+ <?php
370+ class NodeListsEnumerator
371+ {
372+ public function enumerateNodeLists(EnumeratedNode $enumeratedNode, ContentReleaseIdentifier $releaseIdentifier, ContentReleaseLogger $logger)
373+ {
374+ $nodeTypeName = $enumeratedNode->getNodeTypeName();
375+ $nodeType = $this->nodeTypeManager->getNodeType($nodeTypeName);
376+ if ($nodeType->isOfType('Vendor.Site:Document.Blog.Folder')) {
377+ // Get the node and count the number of pages to render
378+ // $pageCount = ...
379+
380+ $pageCount = ceil($postCount / (float)$this->perPage);
381+ if ($pageCount <= 1) {
382+ return;
383+ }
384+
385+ // Start after the first page, because the first page will be the document without arguments
386+ for ($page = 2; $page <= $pageCount; $page++) {
387+ $enumeratedNodes[] = EnumeratedNode::fromNode($documentNode, ['page' => $page]);
388+ }
389+
390+ $this->redisEnumerationRepository->addDocumentNodesToEnumeration($releaseIdentifier, ...$enumeratedNodes);
391+ }
392+ }
393+ }
394+ ` ` `
395+
396+ The actual logic will depend on your use of the node. Having the actual filtering logic implemented in PHP is
397+ beneficial, because it allows you to use it in the rendering process as well as in the additional enumeration.
398+
341399# ## Extending the backend module
342400
343401- You need a Views.yaml in your package, looking like this :
0 commit comments