Skip to content

Commit

Permalink
TASK: Move moveNodeStrategy to Neos UI
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Nov 19, 2024
1 parent f1af995 commit b0fbcbd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Classes/Domain/Model/Changes/MoveAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function apply(): void
$contentRepository = $this->contentRepositoryRegistry->get($subject->contentRepositoryId);
$nodeType = $contentRepository->getNodeTypeManager()->getNodeType($this->subject->nodeTypeName);
$strategy = $nodeType->getConfiguration('options.moveNodeStrategy') ?: throw new \RuntimeException('Nodetype is missing required option "moveNodeStrategy".', 1645577794);
$strategy = RelationDistributionStrategy::fromName($strategy) ?: throw new \RuntimeException('Nodetype has an invalid configuration for option "moveNodeStrategy".', 1645577794);;
$strategy = RelationDistributionStrategy::tryFrom($strategy) ?? throw new \RuntimeException('Nodetype has an invalid configuration for option "moveNodeStrategy".', 1645577794);;
$command = MoveNodeAggregate::create(
$subject->workspaceName,
$subject->dimensionSpacePoint,
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Model/Changes/MoveBefore.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function apply(): void
$contentRepository = $this->contentRepositoryRegistry->get($subject->contentRepositoryId);
$nodeType = $contentRepository->getNodeTypeManager()->getNodeType($this->subject->nodeTypeName);
$strategy = $nodeType->getConfiguration('options.moveNodeStrategy') ?: throw new \RuntimeException('Nodetype is missing required option "moveNodeStrategy".', 1645577794);
$strategy = RelationDistributionStrategy::fromName($strategy) ?: throw new \RuntimeException('Nodetype has an invalid configuration for option "moveNodeStrategy".', 1645577794);
$strategy = RelationDistributionStrategy::tryFrom($strategy) ?? throw new \RuntimeException('Nodetype has an invalid configuration for option "moveNodeStrategy".', 1645577794);
$contentRepository->handle(
MoveNodeAggregate::create(
$subject->workspaceName,
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Model/Changes/MoveInto.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function apply(): void
$contentRepository = $this->contentRepositoryRegistry->get($subject->contentRepositoryId);
$nodeType = $contentRepository->getNodeTypeManager()->getNodeType($this->subject->nodeTypeName);
$strategy = $nodeType->getConfiguration('options.moveNodeStrategy') ?: throw new \RuntimeException('Nodetype is missing required option "moveNodeStrategy".', 1645577794);
$strategy = RelationDistributionStrategy::fromName($strategy) ?: throw new \RuntimeException('Nodetype has an invalid configuration for option "moveNodeStrategy".', 1645577794);
$strategy = RelationDistributionStrategy::tryFrom($strategy) ?? throw new \RuntimeException('Nodetype has an invalid configuration for option "moveNodeStrategy".', 1645577794);
$contentRepository->handle(
MoveNodeAggregate::create(
$subject->workspaceName,
Expand Down
2 changes: 2 additions & 0 deletions Configuration/NodeTypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
factoryClassName: 'Neos\Neos\Ui\Infrastructure\Neos\UriPathSegmentNodeCreationHandlerFactory'
promotedElements:
factoryClassName: 'Neos\Neos\Ui\Infrastructure\ContentRepository\CreationDialog\PromotedElementsCreationHandlerFactory'
moveNodeStrategy: gatherAll

'Neos.Neos:Content':
postprocessors:
Expand All @@ -34,6 +35,7 @@
nodeCreationHandlers:
promotedElements:
factoryClassName: 'Neos\Neos\Ui\Infrastructure\ContentRepository\CreationDialog\PromotedElementsCreationHandlerFactory'
moveNodeStrategy: scatter

'Neos.Neos:ContentCollection':
ui:
Expand Down

0 comments on commit b0fbcbd

Please sign in to comment.