Skip to content

Commit

Permalink
TASK: NodeInterface -> Node; Removal of NodeAccessor
Browse files Browse the repository at this point in the history
  • Loading branch information
skurfuerst committed Aug 18, 2022
1 parent d272333 commit f1c93a4
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions Classes/Fusion/XmlSitemapUrlsImplementation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

use Neos\ContentRepository\NodeAccess\NodeAccessorManager;
use Neos\ContentRepository\Projection\ContentGraph\NodeInterface;
use Neos\ContentRepository\Projection\ContentGraph\Node;
use Neos\ContentRepository\SharedModel\NodeType\NodeType;
use Neos\ContentRepository\SharedModel\NodeType\NodeTypeConstraintParser;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
Expand All @@ -30,12 +30,6 @@ class XmlSitemapUrlsImplementation extends AbstractFusionObject
*/
protected $contentRepositoryRegistry;

/**
* @Flow\Inject
* @var NodeAccessorManager
*/
protected $nodeAccessorManager;

/**
* @Flow\Inject
* @var PersistenceManager
Expand All @@ -58,7 +52,7 @@ class XmlSitemapUrlsImplementation extends AbstractFusionObject
protected $includeImageUrls;

/**
* @var NodeInterface
* @var Node
*/
protected $startingPoint;

Expand Down Expand Up @@ -92,9 +86,9 @@ public function getRenderHiddenInIndex(): bool
}

/**
* @return NodeInterface
* @return Node
*/
public function getStartingPoint(): NodeInterface
public function getStartingPoint(): Node
{
if ($this->startingPoint === null) {
return $this->fusionValue('startingPoint');
Expand Down Expand Up @@ -127,11 +121,11 @@ private function getAssetPropertiesForNodeType(NodeType $nodeType): array

/**
* @param array & $items
* @param NodeInterface $node
* @param Node $node
* @return void
* @throws NodeException
*/
protected function appendItems(array &$items, NodeInterface $node)
protected function appendItems(array &$items, Node $node)
{
if ($this->isDocumentNodeToBeIndexed($node)) {
$item = [
Expand All @@ -154,14 +148,14 @@ protected function appendItems(array &$items, NodeInterface $node)
}

/**
* @param NodeInterface $node
* @param Node $node
* @param array & $item
* @return void
* @throws NodeException
*/
protected function resolveImages(NodeInterface $node, array &$item)
protected function resolveImages(Node $node, array &$item)
{
$assetPropertiesForNodeType = $this->getAssetPropertiesForNodeType($node->getNodeType());
$assetPropertiesForNodeType = $this->getAssetPropertiesForNodeType($node->nodeType);

foreach ($assetPropertiesForNodeType as $propertyName) {
if (is_array($node->getProperty($propertyName)) && !empty($node->getProperty($propertyName))) {
Expand All @@ -175,14 +169,14 @@ protected function resolveImages(NodeInterface $node, array &$item)
}
}

$contentRepository = $this->contentRepositoryRegistry->get($node->getSubgraphIdentity()->contentRepositoryIdentifier);
$contentRepository = $this->contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryIdentifier);
$nodeTypeConstraintParser = NodeTypeConstraintParser::create($contentRepository->getNodeTypeManager());

$nodeAccessor = $this->nodeAccessorManager->accessorFor($node->getSubgraphIdentity());
$childNodes = $nodeAccessor->findChildNodes(
$node,
$nodeTypeConstraintParser->parseFilterString('Neos.Neos:ContentCollection,Neos.Neos:Content')
);
$childNodes = $this->contentRepositoryRegistry->subgraphForNode($node)
->findChildNodes(
$node->nodeAggregateIdentifier,
$nodeTypeConstraintParser->parseFilterString('Neos.Neos:ContentCollection,Neos.Neos:Content')
);

foreach ($childNodes as $childNode) {
$this->resolveImages($childNode, $item);
Expand All @@ -193,13 +187,13 @@ protected function resolveImages(NodeInterface $node, array &$item)
* Return TRUE/FALSE if the node is currently hidden; taking the "renderHiddenInIndex" configuration
* of the Menu Fusion object into account.
*
* @param NodeInterface $node
* @param Node $node
* @return bool
* @throws NodeException
*/
protected function isDocumentNodeToBeIndexed(NodeInterface $node): bool
protected function isDocumentNodeToBeIndexed(Node $node): bool
{
return !$node->getNodeType()->isOfType('Neos.Seo:NoindexMixin')// TODO?? && $node->isVisible()
return !$node->nodeType->isOfType('Neos.Seo:NoindexMixin')// TODO?? && $node->isVisible()
&& ($this->getRenderHiddenInIndex())// TODO?? || !$node->isHiddenInIndex()) && $node->isAccessible()
&& $node->getProperty('metaRobotsNoindex') !== true
&& ((string)$node->getProperty('canonicalLink') === '' || substr($node->getProperty('canonicalLink'), 7) === $node->getNodeAggregateIdentifier()->getValue());
Expand Down

0 comments on commit f1c93a4

Please sign in to comment.