Neos\Neos\Controller\Service\NodesController::createAction PHP Метод

createAction() публичный Метод

The "mode" property defines the basic mode of operation. Currently supported modes: 'adoptFromAnotherDimension': Adopts the single node from another dimension - $identifier, $workspaceName and $sourceDimensions specify the source node - $identifier, $workspaceName and $dimensions specify the target node
public createAction ( string $mode, string $identifier, string $workspaceName = 'live', array $dimensions = [], array $sourceDimensions = [] ) : string
$mode string
$identifier string Specifies the identifier of the node to be created; if source
$workspaceName string Name of the workspace where to create the node in
$dimensions array Optional list of dimensions and their values in which the node should be created
$sourceDimensions array
Результат string
    public function createAction($mode, $identifier, $workspaceName = 'live', array $dimensions = array(), array $sourceDimensions = array())
    {
        if ($mode === 'adoptFromAnotherDimension' || $mode === 'adoptFromAnotherDimensionAndCopyContent') {
            $originalContentContext = $this->createContentContext($workspaceName, $sourceDimensions);
            $node = $originalContentContext->getNodeByIdentifier($identifier);
            if ($node === null) {
                $this->throwStatus(404, 'Original node was not found.');
            }
            $contentContext = $this->createContentContext($workspaceName, $dimensions);
            $this->adoptNodeAndParents($node, $contentContext, $mode === 'adoptFromAnotherDimensionAndCopyContent');
            $this->redirect('show', null, null, array('identifier' => $identifier, 'workspaceName' => $workspaceName, 'dimensions' => $dimensions));
        } else {
            $this->throwStatus(400, sprintf('The create mode "%s" is not supported.', $mode));
        }
    }