Skip to content

Commit 3816e27

Browse files
committed
FEATURE: Allow enumeration of any nodetype
1 parent 9e988aa commit 3816e27

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Classes/NodeEnumeration/NodeEnumerator.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private function enumerateAll(?Site $site, ContentReleaseLogger $contentReleaseL
8181

8282
$nodeTypeWhitelist = $this->nodeTypeConstraintFactory->parseFilterString($this->nodeTypeWhitelist);
8383

84-
$queueSite = function (Site $site) use ($combinator, &$documentNodeVariantsToRender, $nodeTypeWhitelist, $contentReleaseLogger, $workspaceName) {
84+
$queueSite = function (Site $site) use ($combinator, $nodeTypeWhitelist, $contentReleaseLogger, $workspaceName) {
8585
$contentReleaseLogger->debug('Publishing site', [
8686
'name' => $site->getName(),
8787
'domain' => $site->getFirstActiveDomain()
@@ -94,9 +94,18 @@ private function enumerateAll(?Site $site, ContentReleaseLogger $contentReleaseL
9494
'dimensionValues' => $dimensionValues
9595
]);
9696

97+
// Build filter from white listed nodetypes
98+
$nodeTypeWhitelist = explode(',', $this->nodeTypeWhitelist ?: 'Neos.Neos:Document');
99+
$nodeTypeFilter = implode(',', array_map(static function ($nodeType) {
100+
if ($nodeType[0] === '!') {
101+
return '[!instanceof ' . substr($nodeType, 1) . ']';
102+
}
103+
return '[instanceof ' . $nodeType . ']';
104+
}, $nodeTypeWhitelist));
105+
97106
$documentQuery = new FlowQuery([$siteNode]);
98107
/** @var NodeInterface[] $documents */
99-
$documents = $documentQuery->find('[instanceof Neos.Neos:Document]')->add($siteNode)->get();
108+
$documents = $documentQuery->find($nodeTypeFilter)->add($siteNode)->get();
100109

101110
foreach ($documents as $documentNode) {
102111
$contextPath = $documentNode->getContextPath();
@@ -122,17 +131,11 @@ private function enumerateAll(?Site $site, ContentReleaseLogger $contentReleaseL
122131
$contentReleaseLogger->debug('Skipping node from publishing, because it is hidden', [
123132
'node' => $contextPath,
124133
]);
125-
} else if ($nodeTypeWhitelist->matches(NodeTypeName::fromString($documentNode->getNodeType()->getName()))) {
134+
} else {
126135
$contentReleaseLogger->debug('Registering node for publishing', [
127136
'node' => $contextPath
128137
]);
129-
130138
yield EnumeratedNode::fromNode($documentNode);
131-
} else {
132-
$contentReleaseLogger->debug('Skipping node from publishing, because it did not match the configured nodeTypeWhitelist', [
133-
'node' => $contextPath,
134-
'nodeTypeWhitelist' => $this->nodeTypeWhitelist
135-
]);
136139
}
137140
}
138141
}

0 commit comments

Comments
 (0)