final class NeosSubtreeTag (View source)

Neos specific content repository subtree tag definitions {SubtreeTag}

A tag that can be added to Node aggregates that is inherited by all its descendants

By default, Neos provides two kinds of subtree tags:

The visibility constraints {\Neos\Neos\Domain\SubtreeTagging\NeosVisibilityConstraints} define which tagged nodes are queried.

Methods

static SubtreeTag
disabled()

Content repository subtree tag which is used to denote that a node is disabled

static SubtreeTag
removed()

Content repository subtree tag which is used to denote that a node is soft removed

Details

static SubtreeTag disabled()

Content repository subtree tag which is used to denote that a node is disabled

By default, disabled nodes never show up in the fronend rendering of a document.

Disabling a node / its subtree is done via {\Neos\Neos\Domain\SubtreeTagging\TagSubtree}. In reverse enabling a node {\Neos\ContentRepository\Core\Feature\SubtreeTagging\Command\UntagSubtree} is to be used.

$contentRepository->handle(TagSubtree::create(
    $node->workspaceName,
    $node->aggregateId,
    $node->dimensionSpacePoint,
    NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS,
    NeosSubtreeTag::disabled()
));

Return Value

SubtreeTag

static SubtreeTag removed()

Content repository subtree tag which is used to denote that a node is soft removed

Issuing 'hard' removals via {\Neos\Neos\Domain\SubtreeTagging\RemoveNodeAggregate} on a non-live workspace ist not desired in Neos and comes with complications:

  • Hard removals destroy all hierarchy information immediately, making it impossible to locate where a removal took place. A special case imposes the deletion of newly created nodes. Associating content changes with its document is important when publishing via {\Neos\Neos\Domain\SubtreeTagging\WorkspacePublishingService::publishChangesInDocument()}

  • Hard removals easily cause conflicts: The removal of a selected node might not be published in that scope if a node was moved outwards. The rebase will cause conflicts if changes were made in a hierarchy of removed nodes, like moving nodes outwards.

Instead, tagging a node / its subtree via {\Neos\Neos\Domain\SubtreeTagging\TagSubtree} will mark it as removed in Neos.

$contentRepository->handle(TagSubtree::create(
    $node->workspaceName,
    $node->aggregateId,
    $node->dimensionSpacePoint,
    NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS,
    NeosSubtreeTag::removed()
));

Nodes tagged as removed will not show up in the frontend rendering nor in the backend by default. Only subtracting this removed tag from the {\Neos\Neos\Domain\SubtreeTagging\VisibilityConstraints} or operating on the node aggregates directly will make soft removed nodes available.

Return Value

SubtreeTag