Skip to content

Commit

Permalink
!!! TASK: Remove NodeInfoHelper::isAutoCreated for `$node->classifi…
Browse files Browse the repository at this point in the history
…cation === Classification::CLASSIFICATION_TETHERED`
  • Loading branch information
mhsdesign committed Sep 1, 2023
1 parent c464d68 commit ec3ef24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Classes/Domain/Model/Changes/AbstractStructuralChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\NodeType\NodeType;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateClassification;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\ContentRepository\Core\Projection\ContentGraph\Nodes;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
Expand All @@ -25,7 +26,6 @@
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\RenderContentOutOfBand;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\UpdateNodeInfo;
use Neos\Neos\Ui\Domain\Model\RenderedNodeDomAddress;
use Neos\Neos\Ui\Fusion\Helper\NodeInfoHelper;

/**
* A change that performs structural actions like moving or creating nodes
Expand Down Expand Up @@ -187,7 +187,7 @@ protected function findChildNodes(Node $node): Nodes
protected function isNodeTypeAllowedAsChildNode(Node $node, NodeType $nodeType): bool
{
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
if (NodeInfoHelper::isAutoCreated($node, $subgraph)) {
if ($node->classification === NodeAggregateClassification::CLASSIFICATION_TETHERED) {
$parentNode = $subgraph->findParentNode($node->nodeAggregateId);
return !$parentNode || $parentNode->nodeType->allowsGrandchildNodeType(
$node->nodeName->value,
Expand Down
17 changes: 2 additions & 15 deletions Classes/Fusion/Helper/NodeInfoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\Projection\ContentGraph\Nodes;
use Neos\ContentRepository\Core\Projection\NodeHiddenState\NodeHiddenStateFinder;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateClassification;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Eel\ProtectedContextAwareInterface;
use Neos\Flow\Annotations as Flow;
Expand Down Expand Up @@ -236,7 +237,7 @@ protected function getBasicNodeInformation(Node $node): array
'identifier' => $node->nodeAggregateId->jsonSerialize(),
'nodeType' => $node->nodeType->getName(),
'label' => $node->getLabel(),
'isAutoCreated' => self::isAutoCreated($node, $subgraph),
'isAutoCreated' => $node->classification === NodeAggregateClassification::CLASSIFICATION_TETHERED,
// TODO: depth is expensive to calculate; maybe let's get rid of this?
'depth' => $subgraph->countAncestorNodes(
$node->nodeAggregateId,
Expand All @@ -251,20 +252,6 @@ protected function getBasicNodeInformation(Node $node): array
];
}

public static function isAutoCreated(Node $node, ContentSubgraphInterface $subgraph): bool
{
if (!$node->nodeName) {
return false;
}
$parent = $subgraph->findParentNode($node->nodeAggregateId);
if ($parent) {
if (array_key_exists($node->nodeName->value, $parent->nodeType->getAutoCreatedChildNodes())) {
return true;
}
}
return false;
}

/**
* Get information for all children of the given parent node.
*
Expand Down

0 comments on commit ec3ef24

Please sign in to comment.