Neos.Neos/Classes/Service/PublishingService.php
public function publishNode(NodeInterface $node, Workspace $targetWorkspace = null)
    {
        if ($targetWorkspace === null) {
            $targetWorkspace = $node->getWorkspace()->getBaseWorkspace();
        }
        if (!$targetWorkspace instanceof Workspace) {
            return;
        }
        $nodes = [$node];
        $nodeType = $node->getNodeType();

        if ($nodeType->isOfType('Neos.Neos:Document') || $nodeType->hasConfiguration('childNodes')) {
            $nodes = array_merge($nodes, $this->collectAllContentChildNodes($node));
        }
        $sourceWorkspace = $node->getWorkspace();
        $sourceWorkspace->publishNodes($nodes, $targetWorkspace);

        $this->emitNodePublished($node, $targetWorkspace);
    }
public function publishNode(NodeInterface $node, Workspace $targetWorkspace = null)
    {
        if ($targetWorkspace === null) {
            $targetWorkspace = $node->getWorkspace()->getBaseWorkspace();
        }
        if (!$targetWorkspace instanceof Workspace) {
            return;
        }
        $nodes = [$node];
        $nodeType = $node->getNodeType();

        if ($nodeType->isOfType('Neos.Neos:Document') || $nodeType->hasConfiguration('childNodes')) {
            $nodes = array_merge($nodes, $this->collectAllContentChildNodes($node));
        }
        $sourceWorkspace = $node->getWorkspace();
        $sourceWorkspace->publishNodes($nodes, $targetWorkspace);

        $this->emitNodePublished($node, $targetWorkspace);
    }
public function publishNode ( NodeInterface $ node , Workspace $ targetWorkspace = null ) { if ( $ targetWorkspace === null ) { $ targetWorkspace = $ node -> getWorkspace ( ) -> getBaseWorkspace ( ) ; } if ( ! $ targetWorkspace instanceof Workspace ) { return ; } $ nodes = [ $ node ] ; $ nodeType = $ node -> getNodeType ( ) ; if ( $ nodeType -> isOfType ( 'Neos.Neos:Document' ) || $ nodeType -> hasConfiguration ( 'childNodes' ) ) { $ nodes = array_merge ( $ nodes , $ this -> collectAllContentChildNodes ( $ node ) ) ; } $ sourceWorkspace = $ node -> getWorkspace ( ) ; $ sourceWorkspace -> publishNodes ( $ nodes , $ targetWorkspace ) ; $ this -> emitNodePublished ( $ node , $ targetWorkspace ) ; }
Publishes the given node to the specified target workspace. If no workspace is specified, the base workspace
is assumed.

If the given node is a Document or has ContentCollection child nodes, these nodes are published as well.

@param NodeInterface $node
@param Workspace $targetWorkspace If not set the base workspace is assumed to be the publishing target
@return void
@api
Publishes the given node to the specified target workspace . If no workspace is specified the base workspace is assumed .