repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
neos/neos-development-collection | Neos.Neos/Classes/Service/Controller/NodeController.php | NodeController.createAndRenderAction | public function createAndRenderAction(Node $referenceNode, $fusionPath, array $nodeData, $position)
{
$newNode = $this->nodeOperations->create($referenceNode, $nodeData, $position);
$this->redirectToRenderNode($newNode, $fusionPath);
} | php | public function createAndRenderAction(Node $referenceNode, $fusionPath, array $nodeData, $position)
{
$newNode = $this->nodeOperations->create($referenceNode, $nodeData, $position);
$this->redirectToRenderNode($newNode, $fusionPath);
} | [
"public",
"function",
"createAndRenderAction",
"(",
"Node",
"$",
"referenceNode",
",",
"$",
"fusionPath",
",",
"array",
"$",
"nodeData",
",",
"$",
"position",
")",
"{",
"$",
"newNode",
"=",
"$",
"this",
"->",
"nodeOperations",
"->",
"create",
"(",
"$",
"re... | Creates a new node and renders the node inside the containing content collection.
@param Node $referenceNode
@param string $fusionPath The Fusion path of the collection
@param array $nodeData
@param string $position where the node should be added (allowed: before, into, after)
@return string | [
"Creates",
"a",
"new",
"node",
"and",
"renders",
"the",
"node",
"inside",
"the",
"containing",
"content",
"collection",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L204-L208 | train |
neos/neos-development-collection | Neos.Neos/Classes/Service/Controller/NodeController.php | NodeController.createNodeForTheTreeAction | public function createNodeForTheTreeAction(Node $referenceNode, array $nodeData, $position, $nodeTypeFilter = '')
{
$newNode = $this->nodeOperations->create($referenceNode, $nodeData, $position);
$this->view->assignNodeAndChildNodes($newNode, $nodeTypeFilter);
} | php | public function createNodeForTheTreeAction(Node $referenceNode, array $nodeData, $position, $nodeTypeFilter = '')
{
$newNode = $this->nodeOperations->create($referenceNode, $nodeData, $position);
$this->view->assignNodeAndChildNodes($newNode, $nodeTypeFilter);
} | [
"public",
"function",
"createNodeForTheTreeAction",
"(",
"Node",
"$",
"referenceNode",
",",
"array",
"$",
"nodeData",
",",
"$",
"position",
",",
"$",
"nodeTypeFilter",
"=",
"''",
")",
"{",
"$",
"newNode",
"=",
"$",
"this",
"->",
"nodeOperations",
"->",
"crea... | Creates a new node and returns tree structure
@param Node $referenceNode
@param array $nodeData
@param string $position where the node should be added, -1 is before, 0 is in, 1 is after
@param string $nodeTypeFilter
@return void | [
"Creates",
"a",
"new",
"node",
"and",
"returns",
"tree",
"structure"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L219-L223 | train |
neos/neos-development-collection | Neos.Neos/Classes/Service/Controller/NodeController.php | NodeController.moveAndRenderAction | public function moveAndRenderAction(Node $node, Node $targetNode, $position, $fusionPath)
{
$this->nodeOperations->move($node, $targetNode, $position);
$this->redirectToRenderNode($node, $fusionPath);
} | php | public function moveAndRenderAction(Node $node, Node $targetNode, $position, $fusionPath)
{
$this->nodeOperations->move($node, $targetNode, $position);
$this->redirectToRenderNode($node, $fusionPath);
} | [
"public",
"function",
"moveAndRenderAction",
"(",
"Node",
"$",
"node",
",",
"Node",
"$",
"targetNode",
",",
"$",
"position",
",",
"$",
"fusionPath",
")",
"{",
"$",
"this",
"->",
"nodeOperations",
"->",
"move",
"(",
"$",
"node",
",",
"$",
"targetNode",
",... | Move the given node before, into or after the target node depending on the given position and renders it's content collection.
@param Node $node The node to be moved
@param Node $targetNode The target node to be moved "to", see $position
@param string $position Where the node should be added in relation to $targetNode (allowed: before, into, after)
@param string $fusionPath The Fusion path of the collection
@return void | [
"Move",
"the",
"given",
"node",
"before",
"into",
"or",
"after",
"the",
"target",
"node",
"depending",
"on",
"the",
"given",
"position",
"and",
"renders",
"it",
"s",
"content",
"collection",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L260-L264 | train |
neos/neos-development-collection | Neos.Neos/Classes/Service/Controller/NodeController.php | NodeController.copyAndRenderAction | public function copyAndRenderAction(Node $node, Node $targetNode, $position, $fusionPath, $nodeName = null)
{
$copiedNode = $this->nodeOperations->copy($node, $targetNode, $position, $nodeName);
$this->redirectToRenderNode($copiedNode, $fusionPath);
} | php | public function copyAndRenderAction(Node $node, Node $targetNode, $position, $fusionPath, $nodeName = null)
{
$copiedNode = $this->nodeOperations->copy($node, $targetNode, $position, $nodeName);
$this->redirectToRenderNode($copiedNode, $fusionPath);
} | [
"public",
"function",
"copyAndRenderAction",
"(",
"Node",
"$",
"node",
",",
"Node",
"$",
"targetNode",
",",
"$",
"position",
",",
"$",
"fusionPath",
",",
"$",
"nodeName",
"=",
"null",
")",
"{",
"$",
"copiedNode",
"=",
"$",
"this",
"->",
"nodeOperations",
... | Copies the given node before, into or after the target node depending on the given position and renders it's content collection.
@param Node $node The node to be copied
@param Node $targetNode The target node to be copied "to", see $position
@param string $position Where the node should be added in relation to $targetNode (allowed: before, into, after)
@param string $nodeName Optional node name (if empty random node name will be generated)
@param string $fusionPath The Fusion path of the collection
@return void | [
"Copies",
"the",
"given",
"node",
"before",
"into",
"or",
"after",
"the",
"target",
"node",
"depending",
"on",
"the",
"given",
"position",
"and",
"renders",
"it",
"s",
"content",
"collection",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L312-L316 | train |
neos/neos-development-collection | Neos.Neos/Classes/Service/Controller/NodeController.php | NodeController.updateAction | public function updateAction(Node $node)
{
if ($this->request->getHttpRequest()->isMethodSafe() === false) {
$this->persistenceManager->persistAll();
}
$q = new FlowQuery([$node]);
$closestDocumentNode = $q->closest('[instanceof Neos.Neos:Document]')->get(0);
$nextUri = $this->uriBuilder->reset()->setFormat('html')->setCreateAbsoluteUri(true)->uriFor('show', ['node' => $closestDocumentNode], 'Frontend\Node', 'Neos.Neos');
$this->view->assign('value', [
'data' => [
'workspaceNameOfNode' => $node->getWorkspace()->getName(),
'labelOfNode' => $node->getLabel(),
'nextUri' => $nextUri
],
'success' => true
]);
} | php | public function updateAction(Node $node)
{
if ($this->request->getHttpRequest()->isMethodSafe() === false) {
$this->persistenceManager->persistAll();
}
$q = new FlowQuery([$node]);
$closestDocumentNode = $q->closest('[instanceof Neos.Neos:Document]')->get(0);
$nextUri = $this->uriBuilder->reset()->setFormat('html')->setCreateAbsoluteUri(true)->uriFor('show', ['node' => $closestDocumentNode], 'Frontend\Node', 'Neos.Neos');
$this->view->assign('value', [
'data' => [
'workspaceNameOfNode' => $node->getWorkspace()->getName(),
'labelOfNode' => $node->getLabel(),
'nextUri' => $nextUri
],
'success' => true
]);
} | [
"public",
"function",
"updateAction",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"getHttpRequest",
"(",
")",
"->",
"isMethodSafe",
"(",
")",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"persistenceManager",
"->",
... | Updates the specified node.
Returns the following data:
- the (possibly changed) workspace name of the node
- the URI of the closest document node. If $node is a document node (f.e. a Page), the own URI is returned.
This is important to handle renames of nodes correctly.
Note: We do not call $nodeDataRepository->update() here, as ContentRepository has a stateful API for now.
We need to call persistAll() in order to return the nextUri. We can't persist only the nodes in NodeDataRepository
because they might be connected to images / resources which need to be updated at the same time.
@param Node $node The node to be updated
@return void | [
"Updates",
"the",
"specified",
"node",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L334-L351 | train |
neos/neos-development-collection | Neos.Neos/Classes/Service/Controller/NodeController.php | NodeController.deleteAction | public function deleteAction(Node $node)
{
if ($this->request->getHttpRequest()->isMethodSafe() === false) {
$this->persistenceManager->persistAll();
}
$q = new FlowQuery([$node]);
$node->remove();
$closestDocumentNode = $q->closest('[instanceof Neos.Neos:Document]')->get(0);
$nextUri = $this->uriBuilder->reset()->setFormat('html')->setCreateAbsoluteUri(true)->uriFor('show', ['node' => $closestDocumentNode], 'Frontend\Node', 'Neos.Neos');
$this->view->assign('value', ['data' => ['nextUri' => $nextUri], 'success' => true]);
} | php | public function deleteAction(Node $node)
{
if ($this->request->getHttpRequest()->isMethodSafe() === false) {
$this->persistenceManager->persistAll();
}
$q = new FlowQuery([$node]);
$node->remove();
$closestDocumentNode = $q->closest('[instanceof Neos.Neos:Document]')->get(0);
$nextUri = $this->uriBuilder->reset()->setFormat('html')->setCreateAbsoluteUri(true)->uriFor('show', ['node' => $closestDocumentNode], 'Frontend\Node', 'Neos.Neos');
$this->view->assign('value', ['data' => ['nextUri' => $nextUri], 'success' => true]);
} | [
"public",
"function",
"deleteAction",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"getHttpRequest",
"(",
")",
"->",
"isMethodSafe",
"(",
")",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"persistenceManager",
"->",
... | Deletes the specified node and all of its sub nodes
We need to call persistAll() in order to return the nextUri. We can't persist only the nodes in NodeDataRepository
because they might be connected to images / resources which need to be removed at the same time.
@param Node $node
@return void | [
"Deletes",
"the",
"specified",
"node",
"and",
"all",
"of",
"its",
"sub",
"nodes"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L374-L386 | train |
neos/neos-development-collection | Neos.Neos/Classes/Service/Controller/NodeController.php | NodeController.redirectToRenderNode | protected function redirectToRenderNode(NodeInterface $node, $fusionPath)
{
$q = new FlowQuery([$node]);
$closestContentCollection = $q->closest('[instanceof Neos.Neos:ContentCollection]')->get(0);
$closestDocumentNode = $q->closest('[instanceof Neos.Neos:Document]')->get(0);
$this->redirect('show', 'Frontend\\Node', 'Neos.Neos', [
'node' => $closestDocumentNode,
'__nodeContextPath' => $closestContentCollection->getContextPath(),
'__affectedNodeContextPath' => $node->getContextPath(),
'__fusionPath' => $fusionPath
], 0, 303, 'html');
} | php | protected function redirectToRenderNode(NodeInterface $node, $fusionPath)
{
$q = new FlowQuery([$node]);
$closestContentCollection = $q->closest('[instanceof Neos.Neos:ContentCollection]')->get(0);
$closestDocumentNode = $q->closest('[instanceof Neos.Neos:Document]')->get(0);
$this->redirect('show', 'Frontend\\Node', 'Neos.Neos', [
'node' => $closestDocumentNode,
'__nodeContextPath' => $closestContentCollection->getContextPath(),
'__affectedNodeContextPath' => $node->getContextPath(),
'__fusionPath' => $fusionPath
], 0, 303, 'html');
} | [
"protected",
"function",
"redirectToRenderNode",
"(",
"NodeInterface",
"$",
"node",
",",
"$",
"fusionPath",
")",
"{",
"$",
"q",
"=",
"new",
"FlowQuery",
"(",
"[",
"$",
"node",
"]",
")",
";",
"$",
"closestContentCollection",
"=",
"$",
"q",
"->",
"closest",
... | Takes care of creating a redirect to properly render the collection the given node is in.
@param NodeInterface $node
@param string $fusionPath
@return string | [
"Takes",
"care",
"of",
"creating",
"a",
"redirect",
"to",
"properly",
"render",
"the",
"collection",
"the",
"given",
"node",
"is",
"in",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L395-L407 | train |
neos/neos-development-collection | Neos.Neos/Classes/Service/Controller/NodeController.php | NodeController.processNodeForEditorPlugins | protected function processNodeForEditorPlugins(NodeInterface $node)
{
return [
'id' => $node->getPath(),
'name' => $node->getLabel(),
'url' => $this->uriBuilder->uriFor('show', ['node' => $node], 'Frontend\Node', 'Neos.Neos'),
'type' => 'neos/internal-link'
];
} | php | protected function processNodeForEditorPlugins(NodeInterface $node)
{
return [
'id' => $node->getPath(),
'name' => $node->getLabel(),
'url' => $this->uriBuilder->uriFor('show', ['node' => $node], 'Frontend\Node', 'Neos.Neos'),
'type' => 'neos/internal-link'
];
} | [
"protected",
"function",
"processNodeForEditorPlugins",
"(",
"NodeInterface",
"$",
"node",
")",
"{",
"return",
"[",
"'id'",
"=>",
"$",
"node",
"->",
"getPath",
"(",
")",
",",
"'name'",
"=>",
"$",
"node",
"->",
"getLabel",
"(",
")",
",",
"'url'",
"=>",
"$... | Returns an array with the data needed by for example the Hallo and Aloha
link plugins to represent the passed Node instance.
@param NodeInterface $node
@return array | [
"Returns",
"an",
"array",
"with",
"the",
"data",
"needed",
"by",
"for",
"example",
"the",
"Hallo",
"and",
"Aloha",
"link",
"plugins",
"to",
"represent",
"the",
"passed",
"Node",
"instance",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L416-L424 | train |
neos/neos-development-collection | Neos.Neos/Classes/Service/Controller/NodeController.php | NodeController.createContext | protected function createContext($workspaceName)
{
$contextProperties = [
'workspaceName' => $workspaceName
];
$currentDomain = $this->domainRepository->findOneByActiveRequest();
if ($currentDomain !== null) {
$contextProperties['currentSite'] = $currentDomain->getSite();
$contextProperties['currentDomain'] = $currentDomain;
}
return $this->contextFactory->create($contextProperties);
} | php | protected function createContext($workspaceName)
{
$contextProperties = [
'workspaceName' => $workspaceName
];
$currentDomain = $this->domainRepository->findOneByActiveRequest();
if ($currentDomain !== null) {
$contextProperties['currentSite'] = $currentDomain->getSite();
$contextProperties['currentDomain'] = $currentDomain;
}
return $this->contextFactory->create($contextProperties);
} | [
"protected",
"function",
"createContext",
"(",
"$",
"workspaceName",
")",
"{",
"$",
"contextProperties",
"=",
"[",
"'workspaceName'",
"=>",
"$",
"workspaceName",
"]",
";",
"$",
"currentDomain",
"=",
"$",
"this",
"->",
"domainRepository",
"->",
"findOneByActiveRequ... | Create a Context for a workspace given by name to be used in this controller.
@param string $workspaceName Name of the current workspace
@return \Neos\ContentRepository\Domain\Service\Context | [
"Create",
"a",
"Context",
"for",
"a",
"workspace",
"given",
"by",
"name",
"to",
"be",
"used",
"in",
"this",
"controller",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L432-L445 | train |
neos/neos-development-collection | Neos.Neos/Classes/Service/Controller/DataSourceController.php | DataSourceController.getDataSources | public static function getDataSources($objectManager)
{
$reflectionService = $objectManager->get(ReflectionService::class);
$dataSources = [];
$dataSourceClassNames = $reflectionService->getAllImplementationClassNamesForInterface(DataSourceInterface::class);
/** @var $dataSourceClassName DataSourceInterface */
foreach ($dataSourceClassNames as $dataSourceClassName) {
$identifier = $dataSourceClassName::getIdentifier();
if (isset($dataSources[$identifier])) {
throw new NeosException(sprintf('Data source with identifier "%s" is already defined in class %s.', $identifier, $dataSourceClassName), 1414088185);
}
$dataSources[$identifier] = $dataSourceClassName;
}
return $dataSources;
} | php | public static function getDataSources($objectManager)
{
$reflectionService = $objectManager->get(ReflectionService::class);
$dataSources = [];
$dataSourceClassNames = $reflectionService->getAllImplementationClassNamesForInterface(DataSourceInterface::class);
/** @var $dataSourceClassName DataSourceInterface */
foreach ($dataSourceClassNames as $dataSourceClassName) {
$identifier = $dataSourceClassName::getIdentifier();
if (isset($dataSources[$identifier])) {
throw new NeosException(sprintf('Data source with identifier "%s" is already defined in class %s.', $identifier, $dataSourceClassName), 1414088185);
}
$dataSources[$identifier] = $dataSourceClassName;
}
return $dataSources;
} | [
"public",
"static",
"function",
"getDataSources",
"(",
"$",
"objectManager",
")",
"{",
"$",
"reflectionService",
"=",
"$",
"objectManager",
"->",
"get",
"(",
"ReflectionService",
"::",
"class",
")",
";",
"$",
"dataSources",
"=",
"[",
"]",
";",
"$",
"dataSour... | Get available data source implementations
@param ObjectManagerInterface $objectManager
@return array Data source class names indexed by identifier
@Flow\CompileStatic
@throws NeosException | [
"Get",
"available",
"data",
"source",
"implementations"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/DataSourceController.php#L75-L91 | train |
neos/neos-development-collection | Neos.Media/Classes/Domain/ValueObject/Configuration/VariantPreset.php | VariantPreset.matchesMediaType | public function matchesMediaType(string $mediaType): bool
{
foreach ($this->mediaTypePatterns as $mediaTypePattern) {
if ($mediaTypePattern->matches($mediaType)) {
return true;
}
}
return false;
} | php | public function matchesMediaType(string $mediaType): bool
{
foreach ($this->mediaTypePatterns as $mediaTypePattern) {
if ($mediaTypePattern->matches($mediaType)) {
return true;
}
}
return false;
} | [
"public",
"function",
"matchesMediaType",
"(",
"string",
"$",
"mediaType",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"mediaTypePatterns",
"as",
"$",
"mediaTypePattern",
")",
"{",
"if",
"(",
"$",
"mediaTypePattern",
"->",
"matches",
"(",
"$",
... | Checks if any of the defined media type patterns matches the given concrete media type.
@param string $mediaType
@return bool | [
"Checks",
"if",
"any",
"of",
"the",
"defined",
"media",
"type",
"patterns",
"matches",
"the",
"given",
"concrete",
"media",
"type",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/ValueObject/Configuration/VariantPreset.php#L79-L87 | train |
neos/neos-development-collection | Neos.Fusion/Classes/FusionObjects/ComponentImplementation.php | ComponentImplementation.evaluate | public function evaluate()
{
$context = $this->runtime->getCurrentContext();
$renderContext = $this->prepare($context);
$result = $this->render($renderContext);
return $result;
} | php | public function evaluate()
{
$context = $this->runtime->getCurrentContext();
$renderContext = $this->prepare($context);
$result = $this->render($renderContext);
return $result;
} | [
"public",
"function",
"evaluate",
"(",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"runtime",
"->",
"getCurrentContext",
"(",
")",
";",
"$",
"renderContext",
"=",
"$",
"this",
"->",
"prepare",
"(",
"$",
"context",
")",
";",
"$",
"result",
"=",
... | Evaluate the fusion-keys and transfer the result into the context as ``props``
afterwards evaluate the ``renderer`` with this context
@return mixed | [
"Evaluate",
"the",
"fusion",
"-",
"keys",
"and",
"transfer",
"the",
"result",
"into",
"the",
"context",
"as",
"props",
"afterwards",
"evaluate",
"the",
"renderer",
"with",
"this",
"context"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/FusionObjects/ComponentImplementation.php#L40-L46 | train |
neos/neos-development-collection | Neos.Fusion/Classes/FusionObjects/ComponentImplementation.php | ComponentImplementation.render | protected function render($context)
{
$this->runtime->pushContextArray($context);
$result = $this->runtime->render($this->path . '/renderer');
$this->runtime->popContext();
return $result;
} | php | protected function render($context)
{
$this->runtime->pushContextArray($context);
$result = $this->runtime->render($this->path . '/renderer');
$this->runtime->popContext();
return $result;
} | [
"protected",
"function",
"render",
"(",
"$",
"context",
")",
"{",
"$",
"this",
"->",
"runtime",
"->",
"pushContextArray",
"(",
"$",
"context",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"runtime",
"->",
"render",
"(",
"$",
"this",
"->",
"path",
... | Evaluate the renderer with the give context and return
@param $context
@return mixed | [
"Evaluate",
"the",
"renderer",
"with",
"the",
"give",
"context",
"and",
"return"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/FusionObjects/ComponentImplementation.php#L84-L90 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Repository/ContentDimensionRepository.php | ContentDimensionRepository.findAll | public function findAll()
{
$dimensions = [];
foreach ($this->dimensionsConfiguration as $dimensionIdentifier => $dimensionConfiguration) {
$dimensions[] = new ContentDimension($dimensionIdentifier, $dimensionConfiguration['default']);
}
return $dimensions;
} | php | public function findAll()
{
$dimensions = [];
foreach ($this->dimensionsConfiguration as $dimensionIdentifier => $dimensionConfiguration) {
$dimensions[] = new ContentDimension($dimensionIdentifier, $dimensionConfiguration['default']);
}
return $dimensions;
} | [
"public",
"function",
"findAll",
"(",
")",
"{",
"$",
"dimensions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"dimensionsConfiguration",
"as",
"$",
"dimensionIdentifier",
"=>",
"$",
"dimensionConfiguration",
")",
"{",
"$",
"dimensions",
"[",
"]",... | Returns an array of content dimensions that are available in the system.
@return array<\Neos\ContentRepository\Domain\Model\ContentDimension> | [
"Returns",
"an",
"array",
"of",
"content",
"dimensions",
"that",
"are",
"available",
"in",
"the",
"system",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Repository/ContentDimensionRepository.php#L34-L41 | train |
neos/neos-development-collection | Neos.Neos/Classes/Command/WorkspaceCommandController.php | WorkspaceCommandController.discardCommand | public function discardCommand($workspace, $verbose = false, $dryRun = false)
{
$workspaceName = $workspace;
$workspace = $this->workspaceRepository->findOneByName($workspaceName);
if (!$workspace instanceof Workspace) {
$this->outputLine('Workspace "%s" does not exist', [$workspaceName]);
$this->quit(1);
}
try {
$nodes = $this->publishingService->getUnpublishedNodes($workspace);
} catch (\Exception $exception) {
$this->outputLine('An error occurred while fetching unpublished nodes from workspace %s, discard aborted.', [$workspaceName]);
$this->quit(1);
}
$this->outputLine('The workspace %s contains %u unpublished nodes.', [$workspaceName, count($nodes)]);
foreach ($nodes as $node) {
/** @var NodeInterface $node */
if ($node->getPath() !== '/') {
if ($verbose) {
$this->outputLine(' ' . $node->getPath());
}
if (!$dryRun) {
$this->publishingService->discardNode($node);
}
}
}
if (!$dryRun) {
$this->outputLine('Discarded all nodes in workspace %s', [$workspaceName]);
}
} | php | public function discardCommand($workspace, $verbose = false, $dryRun = false)
{
$workspaceName = $workspace;
$workspace = $this->workspaceRepository->findOneByName($workspaceName);
if (!$workspace instanceof Workspace) {
$this->outputLine('Workspace "%s" does not exist', [$workspaceName]);
$this->quit(1);
}
try {
$nodes = $this->publishingService->getUnpublishedNodes($workspace);
} catch (\Exception $exception) {
$this->outputLine('An error occurred while fetching unpublished nodes from workspace %s, discard aborted.', [$workspaceName]);
$this->quit(1);
}
$this->outputLine('The workspace %s contains %u unpublished nodes.', [$workspaceName, count($nodes)]);
foreach ($nodes as $node) {
/** @var NodeInterface $node */
if ($node->getPath() !== '/') {
if ($verbose) {
$this->outputLine(' ' . $node->getPath());
}
if (!$dryRun) {
$this->publishingService->discardNode($node);
}
}
}
if (!$dryRun) {
$this->outputLine('Discarded all nodes in workspace %s', [$workspaceName]);
}
} | [
"public",
"function",
"discardCommand",
"(",
"$",
"workspace",
",",
"$",
"verbose",
"=",
"false",
",",
"$",
"dryRun",
"=",
"false",
")",
"{",
"$",
"workspaceName",
"=",
"$",
"workspace",
";",
"$",
"workspace",
"=",
"$",
"this",
"->",
"workspaceRepository",... | Discard changes in workspace
This command discards all modified, created or deleted nodes in the specified workspace.
@param string $workspace Name of the workspace, for example "user-john"
@param boolean $verbose If enabled, information about individual nodes will be displayed
@param boolean $dryRun If set, only displays which nodes would be discarded, no real changes are committed
@return void | [
"Discard",
"changes",
"in",
"workspace"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/WorkspaceCommandController.php#L138-L171 | train |
neos/neos-development-collection | Neos.Neos/Classes/Command/WorkspaceCommandController.php | WorkspaceCommandController.createCommand | public function createCommand($workspace, $baseWorkspace = 'live', $title = null, $description = null, $owner = '')
{
$workspaceName = $workspace;
$workspace = $this->workspaceRepository->findOneByName($workspaceName);
if ($workspace instanceof Workspace) {
$this->outputLine('Workspace "%s" already exists', [$workspaceName]);
$this->quit(1);
}
$baseWorkspaceName = $baseWorkspace;
$baseWorkspace = $this->workspaceRepository->findOneByName($baseWorkspaceName);
if (!$baseWorkspace instanceof Workspace) {
$this->outputLine('The base workspace "%s" does not exist', [$baseWorkspaceName]);
$this->quit(2);
}
if ($owner === '') {
$owningUser = null;
} else {
$owningUser = $this->userService->getUser($owner);
if ($owningUser === null) {
$this->outputLine('The user "%s" specified as owner does not exist', [$owner]);
$this->quit(3);
}
}
if ($title === null) {
$title = $workspaceName;
}
$workspace = new Workspace($workspaceName, $baseWorkspace, $owningUser);
$workspace->setTitle($title);
$workspace->setDescription($description);
$this->workspaceRepository->add($workspace);
if ($owningUser instanceof User) {
$this->outputLine('Created a new workspace "%s", based on workspace "%s", owned by "%s".', [$workspaceName, $baseWorkspaceName, $owner]);
} else {
$this->outputLine('Created a new workspace "%s", based on workspace "%s".', [$workspaceName, $baseWorkspaceName]);
}
} | php | public function createCommand($workspace, $baseWorkspace = 'live', $title = null, $description = null, $owner = '')
{
$workspaceName = $workspace;
$workspace = $this->workspaceRepository->findOneByName($workspaceName);
if ($workspace instanceof Workspace) {
$this->outputLine('Workspace "%s" already exists', [$workspaceName]);
$this->quit(1);
}
$baseWorkspaceName = $baseWorkspace;
$baseWorkspace = $this->workspaceRepository->findOneByName($baseWorkspaceName);
if (!$baseWorkspace instanceof Workspace) {
$this->outputLine('The base workspace "%s" does not exist', [$baseWorkspaceName]);
$this->quit(2);
}
if ($owner === '') {
$owningUser = null;
} else {
$owningUser = $this->userService->getUser($owner);
if ($owningUser === null) {
$this->outputLine('The user "%s" specified as owner does not exist', [$owner]);
$this->quit(3);
}
}
if ($title === null) {
$title = $workspaceName;
}
$workspace = new Workspace($workspaceName, $baseWorkspace, $owningUser);
$workspace->setTitle($title);
$workspace->setDescription($description);
$this->workspaceRepository->add($workspace);
if ($owningUser instanceof User) {
$this->outputLine('Created a new workspace "%s", based on workspace "%s", owned by "%s".', [$workspaceName, $baseWorkspaceName, $owner]);
} else {
$this->outputLine('Created a new workspace "%s", based on workspace "%s".', [$workspaceName, $baseWorkspaceName]);
}
} | [
"public",
"function",
"createCommand",
"(",
"$",
"workspace",
",",
"$",
"baseWorkspace",
"=",
"'live'",
",",
"$",
"title",
"=",
"null",
",",
"$",
"description",
"=",
"null",
",",
"$",
"owner",
"=",
"''",
")",
"{",
"$",
"workspaceName",
"=",
"$",
"works... | Create a new workspace
This command creates a new workspace.
@param string $workspace Name of the workspace, for example "christmas-campaign"
@param string $baseWorkspace Name of the base workspace. If none is specified, "live" is assumed.
@param string $title Human friendly title of the workspace, for example "Christmas Campaign"
@param string $description A description explaining the purpose of the new workspace
@param string $owner The identifier of a User to own the workspace
@return void | [
"Create",
"a",
"new",
"workspace"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/WorkspaceCommandController.php#L185-L225 | train |
neos/neos-development-collection | Neos.Neos/Classes/Command/WorkspaceCommandController.php | WorkspaceCommandController.deleteCommand | public function deleteCommand($workspace, $force = false)
{
$workspaceName = $workspace;
$workspace = $this->workspaceRepository->findOneByName($workspaceName);
if (!$workspace instanceof Workspace) {
$this->outputLine('Workspace "%s" does not exist', [$workspaceName]);
$this->quit(1);
}
if ($workspace->isPersonalWorkspace()) {
$this->outputLine('Did not delete workspace "%s" because it is a personal workspace. Personal workspaces cannot be deleted manually.', [$workspaceName]);
$this->quit(2);
}
$dependentWorkspaces = $this->workspaceRepository->findByBaseWorkspace($workspace);
if (count($dependentWorkspaces) > 0) {
$this->outputLine('Workspace "%s" cannot be deleted because the following workspaces are based on it:', [$workspaceName]);
$this->outputLine();
$tableRows = [];
$headerRow = ['Name', 'Title', 'Description'];
/** @var Workspace $workspace */
foreach ($dependentWorkspaces as $workspace) {
$tableRows[] = [$workspace->getName(), $workspace->getTitle(), $workspace->getDescription()];
}
$this->output->outputTable($tableRows, $headerRow);
$this->quit(3);
}
try {
$nodesCount = $this->publishingService->getUnpublishedNodesCount($workspace);
} catch (\Exception $exception) {
$this->outputLine('An error occurred while fetching unpublished nodes from workspace %s, nothing was deleted.', [$workspaceName]);
$this->quit(4);
}
if ($nodesCount > 0) {
if ($force === false) {
$this->outputLine('Did not delete workspace "%s" because it contains %s unpublished node(s). Use --force to delete it nevertheless.', [$workspaceName, $nodesCount]);
$this->quit(5);
}
$this->discardCommand($workspaceName);
}
$this->workspaceRepository->remove($workspace);
$this->outputLine('Deleted workspace "%s"', [$workspaceName]);
} | php | public function deleteCommand($workspace, $force = false)
{
$workspaceName = $workspace;
$workspace = $this->workspaceRepository->findOneByName($workspaceName);
if (!$workspace instanceof Workspace) {
$this->outputLine('Workspace "%s" does not exist', [$workspaceName]);
$this->quit(1);
}
if ($workspace->isPersonalWorkspace()) {
$this->outputLine('Did not delete workspace "%s" because it is a personal workspace. Personal workspaces cannot be deleted manually.', [$workspaceName]);
$this->quit(2);
}
$dependentWorkspaces = $this->workspaceRepository->findByBaseWorkspace($workspace);
if (count($dependentWorkspaces) > 0) {
$this->outputLine('Workspace "%s" cannot be deleted because the following workspaces are based on it:', [$workspaceName]);
$this->outputLine();
$tableRows = [];
$headerRow = ['Name', 'Title', 'Description'];
/** @var Workspace $workspace */
foreach ($dependentWorkspaces as $workspace) {
$tableRows[] = [$workspace->getName(), $workspace->getTitle(), $workspace->getDescription()];
}
$this->output->outputTable($tableRows, $headerRow);
$this->quit(3);
}
try {
$nodesCount = $this->publishingService->getUnpublishedNodesCount($workspace);
} catch (\Exception $exception) {
$this->outputLine('An error occurred while fetching unpublished nodes from workspace %s, nothing was deleted.', [$workspaceName]);
$this->quit(4);
}
if ($nodesCount > 0) {
if ($force === false) {
$this->outputLine('Did not delete workspace "%s" because it contains %s unpublished node(s). Use --force to delete it nevertheless.', [$workspaceName, $nodesCount]);
$this->quit(5);
}
$this->discardCommand($workspaceName);
}
$this->workspaceRepository->remove($workspace);
$this->outputLine('Deleted workspace "%s"', [$workspaceName]);
} | [
"public",
"function",
"deleteCommand",
"(",
"$",
"workspace",
",",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"workspaceName",
"=",
"$",
"workspace",
";",
"$",
"workspace",
"=",
"$",
"this",
"->",
"workspaceRepository",
"->",
"findOneByName",
"(",
"$",
"wo... | Deletes a workspace
This command deletes a workspace. If you only want to empty a workspace and not delete the
workspace itself, use <i>workspace:discard</i> instead.
@param string $workspace Name of the workspace, for example "christmas-campaign"
@param boolean $force Delete the workspace and all of its contents
@return void
@see neos.neos:workspace:discard | [
"Deletes",
"a",
"workspace"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/WorkspaceCommandController.php#L238-L284 | train |
neos/neos-development-collection | Neos.Neos/Classes/Command/WorkspaceCommandController.php | WorkspaceCommandController.rebaseCommand | public function rebaseCommand($workspace, $baseWorkspace)
{
$workspaceName = $workspace;
$workspace = $this->workspaceRepository->findOneByName($workspaceName);
if (!$workspace instanceof Workspace) {
$this->outputLine('Workspace "%s" does not exist', [$workspaceName]);
$this->quit(1);
}
$baseWorkspaceName = $baseWorkspace;
$baseWorkspace = $this->workspaceRepository->findOneByName($baseWorkspaceName);
if (!$baseWorkspace instanceof Workspace) {
$this->outputLine('The base workspace "%s" does not exist', [$baseWorkspaceName]);
$this->quit(2);
}
$workspace->setBaseWorkspace($baseWorkspace);
$this->workspaceRepository->update($workspace);
$this->outputLine('Set "%s" as the new base workspace for "%s".', [$baseWorkspaceName, $workspaceName]);
} | php | public function rebaseCommand($workspace, $baseWorkspace)
{
$workspaceName = $workspace;
$workspace = $this->workspaceRepository->findOneByName($workspaceName);
if (!$workspace instanceof Workspace) {
$this->outputLine('Workspace "%s" does not exist', [$workspaceName]);
$this->quit(1);
}
$baseWorkspaceName = $baseWorkspace;
$baseWorkspace = $this->workspaceRepository->findOneByName($baseWorkspaceName);
if (!$baseWorkspace instanceof Workspace) {
$this->outputLine('The base workspace "%s" does not exist', [$baseWorkspaceName]);
$this->quit(2);
}
$workspace->setBaseWorkspace($baseWorkspace);
$this->workspaceRepository->update($workspace);
$this->outputLine('Set "%s" as the new base workspace for "%s".', [$baseWorkspaceName, $workspaceName]);
} | [
"public",
"function",
"rebaseCommand",
"(",
"$",
"workspace",
",",
"$",
"baseWorkspace",
")",
"{",
"$",
"workspaceName",
"=",
"$",
"workspace",
";",
"$",
"workspace",
"=",
"$",
"this",
"->",
"workspaceRepository",
"->",
"findOneByName",
"(",
"$",
"workspaceNam... | Rebase a workspace
This command sets a new base workspace for the specified workspace. Note that doing so will put the possible
changes contained in the workspace to be rebased into a different context and thus might lead to unintended
results when being published.
@param string $workspace Name of the workspace to rebase, for example "user-john"
@param string $baseWorkspace Name of the new base workspace
@return void | [
"Rebase",
"a",
"workspace"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/WorkspaceCommandController.php#L297-L317 | train |
neos/neos-development-collection | Neos.Neos/Classes/Command/WorkspaceCommandController.php | WorkspaceCommandController.listCommand | public function listCommand()
{
$workspaces = $this->workspaceRepository->findAll();
if ($workspaces->count() === 0) {
$this->outputLine('No workspaces found.');
$this->quit(0);
}
$tableRows = [];
$headerRow = ['Name', 'Base Workspace', 'Title', 'Owner', 'Description'];
foreach ($workspaces as $workspace) {
$owner = $workspace->getOwner() ? $workspace->getOwner()->getName() : '';
$tableRows[] = [$workspace->getName(), ($workspace->getBaseWorkspace() ? $workspace->getBaseWorkspace()->getName() : ''), $workspace->getTitle(), $owner, $workspace->getDescription()];
}
$this->output->outputTable($tableRows, $headerRow);
} | php | public function listCommand()
{
$workspaces = $this->workspaceRepository->findAll();
if ($workspaces->count() === 0) {
$this->outputLine('No workspaces found.');
$this->quit(0);
}
$tableRows = [];
$headerRow = ['Name', 'Base Workspace', 'Title', 'Owner', 'Description'];
foreach ($workspaces as $workspace) {
$owner = $workspace->getOwner() ? $workspace->getOwner()->getName() : '';
$tableRows[] = [$workspace->getName(), ($workspace->getBaseWorkspace() ? $workspace->getBaseWorkspace()->getName() : ''), $workspace->getTitle(), $owner, $workspace->getDescription()];
}
$this->output->outputTable($tableRows, $headerRow);
} | [
"public",
"function",
"listCommand",
"(",
")",
"{",
"$",
"workspaces",
"=",
"$",
"this",
"->",
"workspaceRepository",
"->",
"findAll",
"(",
")",
";",
"if",
"(",
"$",
"workspaces",
"->",
"count",
"(",
")",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"out... | Display a list of existing workspaces
@return void | [
"Display",
"a",
"list",
"of",
"existing",
"workspaces"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/WorkspaceCommandController.php#L356-L373 | train |
neos/neos-development-collection | Neos.Neos/Classes/EventLog/Domain/Model/NodeEvent.php | NodeEvent.setNode | public function setNode(NodeInterface $node)
{
$this->nodeIdentifier = $node->getIdentifier();
$this->workspaceName = $node->getContext()->getWorkspaceName();
$this->dimension = $node->getContext()->getDimensions();
$context = $node->getContext();
if ($context instanceof ContentContext && $context->getCurrentSite() !== null) {
$siteIdentifier = $this->persistenceManager->getIdentifierByObject($context->getCurrentSite());
} else {
$siteIdentifier = null;
}
$this->data = Arrays::arrayMergeRecursiveOverrule($this->data, [
'nodeContextPath' => $node->getContextPath(),
'nodeLabel' => $node->getLabel(),
'nodeType' => $node->getNodeType()->getName(),
'site' => $siteIdentifier
]);
$node = self::getClosestAggregateNode($node);
if ($node !== null) {
$this->documentNodeIdentifier = $node->getIdentifier();
$this->data = Arrays::arrayMergeRecursiveOverrule($this->data, [
'documentNodeContextPath' => $node->getContextPath(),
'documentNodeLabel' => $node->getLabel(),
'documentNodeType' => $node->getNodeType()->getName()
]);
}
} | php | public function setNode(NodeInterface $node)
{
$this->nodeIdentifier = $node->getIdentifier();
$this->workspaceName = $node->getContext()->getWorkspaceName();
$this->dimension = $node->getContext()->getDimensions();
$context = $node->getContext();
if ($context instanceof ContentContext && $context->getCurrentSite() !== null) {
$siteIdentifier = $this->persistenceManager->getIdentifierByObject($context->getCurrentSite());
} else {
$siteIdentifier = null;
}
$this->data = Arrays::arrayMergeRecursiveOverrule($this->data, [
'nodeContextPath' => $node->getContextPath(),
'nodeLabel' => $node->getLabel(),
'nodeType' => $node->getNodeType()->getName(),
'site' => $siteIdentifier
]);
$node = self::getClosestAggregateNode($node);
if ($node !== null) {
$this->documentNodeIdentifier = $node->getIdentifier();
$this->data = Arrays::arrayMergeRecursiveOverrule($this->data, [
'documentNodeContextPath' => $node->getContextPath(),
'documentNodeLabel' => $node->getLabel(),
'documentNodeType' => $node->getNodeType()->getName()
]);
}
} | [
"public",
"function",
"setNode",
"(",
"NodeInterface",
"$",
"node",
")",
"{",
"$",
"this",
"->",
"nodeIdentifier",
"=",
"$",
"node",
"->",
"getIdentifier",
"(",
")",
";",
"$",
"this",
"->",
"workspaceName",
"=",
"$",
"node",
"->",
"getContext",
"(",
")",... | Set the "context node" this operation was working on.
@param NodeInterface $node
@return void | [
"Set",
"the",
"context",
"node",
"this",
"operation",
"was",
"working",
"on",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Domain/Model/NodeEvent.php#L137-L166 | train |
neos/neos-development-collection | Neos.Neos/Classes/EventLog/Domain/Model/NodeEvent.php | NodeEvent.getClosestAggregateNode | public static function getClosestAggregateNode(NodeInterface $node)
{
while ($node !== null && !$node->getNodeType()->isAggregate()) {
$node = $node->getParent();
}
return $node;
} | php | public static function getClosestAggregateNode(NodeInterface $node)
{
while ($node !== null && !$node->getNodeType()->isAggregate()) {
$node = $node->getParent();
}
return $node;
} | [
"public",
"static",
"function",
"getClosestAggregateNode",
"(",
"NodeInterface",
"$",
"node",
")",
"{",
"while",
"(",
"$",
"node",
"!==",
"null",
"&&",
"!",
"$",
"node",
"->",
"getNodeType",
"(",
")",
"->",
"isAggregate",
"(",
")",
")",
"{",
"$",
"node",... | Returns the closest aggregate node of the given node
@param NodeInterface $node
@return NodeInterface | [
"Returns",
"the",
"closest",
"aggregate",
"node",
"of",
"the",
"given",
"node"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Domain/Model/NodeEvent.php#L185-L191 | train |
neos/neos-development-collection | Neos.Neos/Classes/EventLog/Domain/Model/NodeEvent.php | NodeEvent.getDocumentNode | public function getDocumentNode()
{
try {
$context = $this->contextFactory->create([
'workspaceName' => $this->userService->getPersonalWorkspaceName(),
'dimensions' => $this->dimension,
'currentSite' => $this->getCurrentSite(),
'invisibleContentShown' => true
]);
return $context->getNodeByIdentifier($this->documentNodeIdentifier);
} catch (EntityNotFoundException $e) {
return null;
}
} | php | public function getDocumentNode()
{
try {
$context = $this->contextFactory->create([
'workspaceName' => $this->userService->getPersonalWorkspaceName(),
'dimensions' => $this->dimension,
'currentSite' => $this->getCurrentSite(),
'invisibleContentShown' => true
]);
return $context->getNodeByIdentifier($this->documentNodeIdentifier);
} catch (EntityNotFoundException $e) {
return null;
}
} | [
"public",
"function",
"getDocumentNode",
"(",
")",
"{",
"try",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"contextFactory",
"->",
"create",
"(",
"[",
"'workspaceName'",
"=>",
"$",
"this",
"->",
"userService",
"->",
"getPersonalWorkspaceName",
"(",
")",
","... | Returns the closest document node, if it can be resolved.
It might happen that, if this event refers to a node contained in a site which is not available anymore,
Doctrine's proxy class of the Site domain model will fail with an EntityNotFoundException. We catch this
case and return NULL.
@return NodeInterface | [
"Returns",
"the",
"closest",
"document",
"node",
"if",
"it",
"can",
"be",
"resolved",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Domain/Model/NodeEvent.php#L202-L215 | train |
neos/neos-development-collection | Neos.Neos/Classes/EventLog/Domain/Model/NodeEvent.php | NodeEvent.getNode | public function getNode()
{
try {
$context = $this->contextFactory->create([
'workspaceName' => $this->userService->getPersonalWorkspaceName(),
'dimensions' => $this->dimension,
'currentSite' => $this->getCurrentSite(),
'invisibleContentShown' => true
]);
return $context->getNodeByIdentifier($this->nodeIdentifier);
} catch (EntityNotFoundException $e) {
return null;
}
} | php | public function getNode()
{
try {
$context = $this->contextFactory->create([
'workspaceName' => $this->userService->getPersonalWorkspaceName(),
'dimensions' => $this->dimension,
'currentSite' => $this->getCurrentSite(),
'invisibleContentShown' => true
]);
return $context->getNodeByIdentifier($this->nodeIdentifier);
} catch (EntityNotFoundException $e) {
return null;
}
} | [
"public",
"function",
"getNode",
"(",
")",
"{",
"try",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"contextFactory",
"->",
"create",
"(",
"[",
"'workspaceName'",
"=>",
"$",
"this",
"->",
"userService",
"->",
"getPersonalWorkspaceName",
"(",
")",
",",
"'di... | Returns the node this even refers to, if it can be resolved.
It might happen that, if this event refers to a node contained in a site which is not available anymore,
Doctrine's proxy class of the Site domain model will fail with an EntityNotFoundException. We catch this
case and return NULL.
@return NodeInterface | [
"Returns",
"the",
"node",
"this",
"even",
"refers",
"to",
"if",
"it",
"can",
"be",
"resolved",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Domain/Model/NodeEvent.php#L226-L239 | train |
neos/neos-development-collection | Neos.Neos/Classes/EventLog/Domain/Model/NodeEvent.php | NodeEvent.getCurrentSite | protected function getCurrentSite()
{
if (!isset($this->data['site']) || $this->data['site'] === null) {
return null;
}
return $this->siteRepository->findByIdentifier($this->data['site']);
} | php | protected function getCurrentSite()
{
if (!isset($this->data['site']) || $this->data['site'] === null) {
return null;
}
return $this->siteRepository->findByIdentifier($this->data['site']);
} | [
"protected",
"function",
"getCurrentSite",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'site'",
"]",
")",
"||",
"$",
"this",
"->",
"data",
"[",
"'site'",
"]",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
... | Prevents invalid calls to the site repository in case the site data property is not available.
@return null|object | [
"Prevents",
"invalid",
"calls",
"to",
"the",
"site",
"repository",
"in",
"case",
"the",
"site",
"data",
"property",
"is",
"not",
"available",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Domain/Model/NodeEvent.php#L246-L253 | train |
neos/neos-development-collection | Neos.Fusion/Classes/FusionObjects/TagImplementation.php | TagImplementation.evaluate | public function evaluate()
{
$tagName = $this->getTagName();
$omitClosingTag = $this->getOmitClosingTag();
$selfClosingTag = $this->isSelfClosingTag($tagName);
$content = '';
if (!$omitClosingTag && !$selfClosingTag) {
$content = $this->fusionValue('content');
}
return '<' . $tagName . $this->fusionValue('attributes') . ($selfClosingTag ? ' /' : '') . '>' . (!$omitClosingTag && !$selfClosingTag ? $content . '</' . $tagName . '>' : '');
} | php | public function evaluate()
{
$tagName = $this->getTagName();
$omitClosingTag = $this->getOmitClosingTag();
$selfClosingTag = $this->isSelfClosingTag($tagName);
$content = '';
if (!$omitClosingTag && !$selfClosingTag) {
$content = $this->fusionValue('content');
}
return '<' . $tagName . $this->fusionValue('attributes') . ($selfClosingTag ? ' /' : '') . '>' . (!$omitClosingTag && !$selfClosingTag ? $content . '</' . $tagName . '>' : '');
} | [
"public",
"function",
"evaluate",
"(",
")",
"{",
"$",
"tagName",
"=",
"$",
"this",
"->",
"getTagName",
"(",
")",
";",
"$",
"omitClosingTag",
"=",
"$",
"this",
"->",
"getOmitClosingTag",
"(",
")",
";",
"$",
"selfClosingTag",
"=",
"$",
"this",
"->",
"isS... | Return a tag
@return mixed | [
"Return",
"a",
"tag"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/FusionObjects/TagImplementation.php#L71-L81 | train |
neos/neos-development-collection | Neos.Neos/Classes/NodeTypePostprocessor/PluginNodeTypePostprocessor.php | PluginNodeTypePostprocessor.process | public function process(NodeType $nodeType, array &$configuration, array $options)
{
$pluginViewDefinitions = $this->pluginService->getPluginViewDefinitionsByPluginNodeType($nodeType);
if ($pluginViewDefinitions === []) {
return;
}
$configuration['ui']['inspector']['groups']['pluginViews'] = [
'position' => '9999',
'label' => 'Plugin Views'
];
$configuration['properties']['views'] = [
'type' => 'string',
'ui' => [
'inspector' => [
'group' => 'pluginViews',
'position' => '20',
'editor' => 'Neos.Neos/Inspector/Editors/PluginViewsEditor'
]
]
];
} | php | public function process(NodeType $nodeType, array &$configuration, array $options)
{
$pluginViewDefinitions = $this->pluginService->getPluginViewDefinitionsByPluginNodeType($nodeType);
if ($pluginViewDefinitions === []) {
return;
}
$configuration['ui']['inspector']['groups']['pluginViews'] = [
'position' => '9999',
'label' => 'Plugin Views'
];
$configuration['properties']['views'] = [
'type' => 'string',
'ui' => [
'inspector' => [
'group' => 'pluginViews',
'position' => '20',
'editor' => 'Neos.Neos/Inspector/Editors/PluginViewsEditor'
]
]
];
} | [
"public",
"function",
"process",
"(",
"NodeType",
"$",
"nodeType",
",",
"array",
"&",
"$",
"configuration",
",",
"array",
"$",
"options",
")",
"{",
"$",
"pluginViewDefinitions",
"=",
"$",
"this",
"->",
"pluginService",
"->",
"getPluginViewDefinitionsByPluginNodeTy... | Returns the processed Configuration
@param \Neos\ContentRepository\Domain\Model\NodeType $nodeType (uninitialized) The node type to process
@param array $configuration input configuration
@param array $options The processor options
@return void | [
"Returns",
"the",
"processed",
"Configuration"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/NodeTypePostprocessor/PluginNodeTypePostprocessor.php#L46-L66 | train |
neos/neos-development-collection | Neos.Fusion/Classes/Core/ExceptionHandlers/ContextDependentHandler.php | ContextDependentHandler.handle | protected function handle($fusionPath, \Exception $exception, $referenceCode)
{
$context = $this->environment->getContext();
if ($context->isDevelopment()) {
$handler = new HtmlMessageHandler();
} else {
$handler = new XmlCommentHandler();
}
$handler->setRuntime($this->getRuntime());
return $handler->handleRenderingException($fusionPath, $exception);
} | php | protected function handle($fusionPath, \Exception $exception, $referenceCode)
{
$context = $this->environment->getContext();
if ($context->isDevelopment()) {
$handler = new HtmlMessageHandler();
} else {
$handler = new XmlCommentHandler();
}
$handler->setRuntime($this->getRuntime());
return $handler->handleRenderingException($fusionPath, $exception);
} | [
"protected",
"function",
"handle",
"(",
"$",
"fusionPath",
",",
"\\",
"Exception",
"$",
"exception",
",",
"$",
"referenceCode",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"environment",
"->",
"getContext",
"(",
")",
";",
"if",
"(",
"$",
"context",... | Handle an exception depending on the context with an HTML message or XML comment
@param array $fusionPath path causing the exception
@param \Exception $exception exception to handle
@param integer $referenceCode
@return string | [
"Handle",
"an",
"exception",
"depending",
"on",
"the",
"context",
"with",
"an",
"HTML",
"message",
"or",
"XML",
"comment"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/ExceptionHandlers/ContextDependentHandler.php#L37-L47 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php | DimensionsMenuItemsImplementation.buildItems | protected function buildItems()
{
$menuItems = [];
$targetDimensionsToMatch = [];
$allDimensionPresets = $this->configurationContentDimensionPresetSource->getAllPresets();
$includeAllPresets = $this->getIncludeAllPresets();
$pinnedDimensionValues = $this->getPresets();
$pinnedDimensionName = $this->getDimension();
if ($pinnedDimensionName !== null) {
$targetDimensionsToMatch = $this->currentNode->getContext()->getTargetDimensions();
unset($targetDimensionsToMatch[$pinnedDimensionName]);
}
foreach ($this->contentDimensionCombinator->getAllAllowedCombinations() as $allowedCombination) {
$targetDimensions = $this->calculateTargetDimensionsForCombination($allowedCombination);
if ($pinnedDimensionName !== null && is_array($pinnedDimensionValues)) {
if (!in_array($targetDimensions[$pinnedDimensionName], $pinnedDimensionValues)) {
continue;
}
}
// skip variants not matching the current target dimensions (except the dimension this menu covers)
if ($targetDimensionsToMatch !== []) {
foreach ($targetDimensionsToMatch as $dimensionName => $dimensionValue) {
if ($targetDimensions[$dimensionName] !== $dimensionValue) {
continue 2;
}
}
}
$nodeInDimensions = $this->getNodeInDimensions($allowedCombination, $targetDimensions);
// no match, so we look further...
if ($nodeInDimensions === null && $includeAllPresets) {
$nodeInDimensions = $this->findAcceptableNode($allowedCombination, $allDimensionPresets);
}
if ($nodeInDimensions !== null && ($this->isNodeHidden($nodeInDimensions) || $this->hasHiddenNodeParent($nodeInDimensions))) {
$nodeInDimensions = null;
}
// determine metadata for target dimensions of node
array_walk($targetDimensions, function (&$dimensionValue, $dimensionName, $allDimensionPresets) use ($pinnedDimensionName) {
$dimensionValue = [
'value' => $dimensionValue,
'label' => $allDimensionPresets[$dimensionName]['presets'][$dimensionValue]['label'],
'isPinnedDimension' => ($pinnedDimensionName === null || $dimensionName == $pinnedDimensionName) ? true : false
];
}, $allDimensionPresets);
$menuItems[] = [
'node' => $nodeInDimensions,
'state' => $this->calculateItemState($nodeInDimensions),
'label' => $this->itemLabel($pinnedDimensionName, $nodeInDimensions, $targetDimensions),
'dimensions' => $allowedCombination,
'targetDimensions' => $targetDimensions
];
}
// sort/limit according to configured "presets" if needed
if ($pinnedDimensionName !== null && is_array($pinnedDimensionValues)) {
$sortedMenuItems = [];
foreach ($pinnedDimensionValues as $pinnedDimensionValue) {
foreach ($menuItems as $menuItemKey => $menuItem) {
if ($menuItem['targetDimensions'][$pinnedDimensionName]['value'] === $pinnedDimensionValue) {
$sortedMenuItems[$menuItemKey] = $menuItem;
}
}
}
return $sortedMenuItems;
}
return $menuItems;
} | php | protected function buildItems()
{
$menuItems = [];
$targetDimensionsToMatch = [];
$allDimensionPresets = $this->configurationContentDimensionPresetSource->getAllPresets();
$includeAllPresets = $this->getIncludeAllPresets();
$pinnedDimensionValues = $this->getPresets();
$pinnedDimensionName = $this->getDimension();
if ($pinnedDimensionName !== null) {
$targetDimensionsToMatch = $this->currentNode->getContext()->getTargetDimensions();
unset($targetDimensionsToMatch[$pinnedDimensionName]);
}
foreach ($this->contentDimensionCombinator->getAllAllowedCombinations() as $allowedCombination) {
$targetDimensions = $this->calculateTargetDimensionsForCombination($allowedCombination);
if ($pinnedDimensionName !== null && is_array($pinnedDimensionValues)) {
if (!in_array($targetDimensions[$pinnedDimensionName], $pinnedDimensionValues)) {
continue;
}
}
// skip variants not matching the current target dimensions (except the dimension this menu covers)
if ($targetDimensionsToMatch !== []) {
foreach ($targetDimensionsToMatch as $dimensionName => $dimensionValue) {
if ($targetDimensions[$dimensionName] !== $dimensionValue) {
continue 2;
}
}
}
$nodeInDimensions = $this->getNodeInDimensions($allowedCombination, $targetDimensions);
// no match, so we look further...
if ($nodeInDimensions === null && $includeAllPresets) {
$nodeInDimensions = $this->findAcceptableNode($allowedCombination, $allDimensionPresets);
}
if ($nodeInDimensions !== null && ($this->isNodeHidden($nodeInDimensions) || $this->hasHiddenNodeParent($nodeInDimensions))) {
$nodeInDimensions = null;
}
// determine metadata for target dimensions of node
array_walk($targetDimensions, function (&$dimensionValue, $dimensionName, $allDimensionPresets) use ($pinnedDimensionName) {
$dimensionValue = [
'value' => $dimensionValue,
'label' => $allDimensionPresets[$dimensionName]['presets'][$dimensionValue]['label'],
'isPinnedDimension' => ($pinnedDimensionName === null || $dimensionName == $pinnedDimensionName) ? true : false
];
}, $allDimensionPresets);
$menuItems[] = [
'node' => $nodeInDimensions,
'state' => $this->calculateItemState($nodeInDimensions),
'label' => $this->itemLabel($pinnedDimensionName, $nodeInDimensions, $targetDimensions),
'dimensions' => $allowedCombination,
'targetDimensions' => $targetDimensions
];
}
// sort/limit according to configured "presets" if needed
if ($pinnedDimensionName !== null && is_array($pinnedDimensionValues)) {
$sortedMenuItems = [];
foreach ($pinnedDimensionValues as $pinnedDimensionValue) {
foreach ($menuItems as $menuItemKey => $menuItem) {
if ($menuItem['targetDimensions'][$pinnedDimensionName]['value'] === $pinnedDimensionValue) {
$sortedMenuItems[$menuItemKey] = $menuItem;
}
}
}
return $sortedMenuItems;
}
return $menuItems;
} | [
"protected",
"function",
"buildItems",
"(",
")",
"{",
"$",
"menuItems",
"=",
"[",
"]",
";",
"$",
"targetDimensionsToMatch",
"=",
"[",
"]",
";",
"$",
"allDimensionPresets",
"=",
"$",
"this",
"->",
"configurationContentDimensionPresetSource",
"->",
"getAllPresets",
... | Builds the array of Menu items for this variant menu | [
"Builds",
"the",
"array",
"of",
"Menu",
"items",
"for",
"this",
"variant",
"menu"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php#L65-L141 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php | DimensionsMenuItemsImplementation.getNodeInDimensions | protected function getNodeInDimensions(array $dimensions, array $targetDimensions)
{
$q = new FlowQuery([$this->currentNode]);
return $q->context([
'dimensions' => $dimensions,
'targetDimensions' => $targetDimensions
])->get(0);
} | php | protected function getNodeInDimensions(array $dimensions, array $targetDimensions)
{
$q = new FlowQuery([$this->currentNode]);
return $q->context([
'dimensions' => $dimensions,
'targetDimensions' => $targetDimensions
])->get(0);
} | [
"protected",
"function",
"getNodeInDimensions",
"(",
"array",
"$",
"dimensions",
",",
"array",
"$",
"targetDimensions",
")",
"{",
"$",
"q",
"=",
"new",
"FlowQuery",
"(",
"[",
"$",
"this",
"->",
"currentNode",
"]",
")",
";",
"return",
"$",
"q",
"->",
"con... | Get the current node in the given dimensions.
If it doesn't exist the method returns null.
@param array $dimensions
@param array $targetDimensions
@return NodeInterface|null | [
"Get",
"the",
"current",
"node",
"in",
"the",
"given",
"dimensions",
".",
"If",
"it",
"doesn",
"t",
"exist",
"the",
"method",
"returns",
"null",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php#L175-L183 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php | DimensionsMenuItemsImplementation.calculateTargetDimensionsForCombination | protected function calculateTargetDimensionsForCombination(array $dimensionCombination)
{
$targetDimensions = [];
foreach ($dimensionCombination as $dimensionName => $dimensionValues) {
$targetDimensions[$dimensionName] = reset($dimensionValues);
}
return $targetDimensions;
} | php | protected function calculateTargetDimensionsForCombination(array $dimensionCombination)
{
$targetDimensions = [];
foreach ($dimensionCombination as $dimensionName => $dimensionValues) {
$targetDimensions[$dimensionName] = reset($dimensionValues);
}
return $targetDimensions;
} | [
"protected",
"function",
"calculateTargetDimensionsForCombination",
"(",
"array",
"$",
"dimensionCombination",
")",
"{",
"$",
"targetDimensions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"dimensionCombination",
"as",
"$",
"dimensionName",
"=>",
"$",
"dimensionValues",... | Calculates the target dimensions for a given dimension combination.
@param array $dimensionCombination
@return array | [
"Calculates",
"the",
"target",
"dimensions",
"for",
"a",
"given",
"dimension",
"combination",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php#L215-L223 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php | DimensionsMenuItemsImplementation.hasHiddenNodeParent | protected function hasHiddenNodeParent(NodeInterface $node): bool
{
$rootNode = $node->getContext()->getRootNode();
$nodesOnPath = $node->getContext()->getNodesOnPath($rootNode, $node);
return count($nodesOnPath) < $node->getDepth();
} | php | protected function hasHiddenNodeParent(NodeInterface $node): bool
{
$rootNode = $node->getContext()->getRootNode();
$nodesOnPath = $node->getContext()->getNodesOnPath($rootNode, $node);
return count($nodesOnPath) < $node->getDepth();
} | [
"protected",
"function",
"hasHiddenNodeParent",
"(",
"NodeInterface",
"$",
"node",
")",
":",
"bool",
"{",
"$",
"rootNode",
"=",
"$",
"node",
"->",
"getContext",
"(",
")",
"->",
"getRootNode",
"(",
")",
";",
"$",
"nodesOnPath",
"=",
"$",
"node",
"->",
"ge... | Returns TRUE if the node has a inaccessible parent.
@param NodeInterface $node
@return bool | [
"Returns",
"TRUE",
"if",
"the",
"node",
"has",
"a",
"inaccessible",
"parent",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php#L231-L237 | train |
neos/neos-development-collection | Neos.Fusion/Classes/FusionObjects/ReduceImplementation.php | ReduceImplementation.evaluate | public function evaluate()
{
$items = $this->getItems();
$value = $this->getInitialValue();
if ($items === null) {
return $value;
}
$this->numberOfRenderedNodes = 0;
$itemName = $this->getItemName();
if ($itemName === null) {
throw new FusionException('The Reduction needs an itemName to be set.', 1537890155);
}
$carryName = $this->getCarryName();
if ($carryName === null) {
throw new FusionException('The Reduction needs an carryName to be set.', 1537890148);
}
$itemKeyName = $this->getItemKey();
$iterationName = $this->getIterationName();
$collectionTotalCount = count($items);
foreach ($items as $itemKey => $item) {
$context = $this->runtime->getCurrentContext();
$context[$itemName] = $item;
$context[$carryName] = $value;
if ($itemKeyName !== null) {
$context[$itemKeyName] = $itemKey;
}
if ($iterationName !== null) {
$context[$iterationName] = $this->prepareIterationInformation($collectionTotalCount);
}
$this->runtime->pushContextArray($context);
$value = $this->runtime->render($this->path . '/itemReducer');
$this->runtime->popContext();
$this->numberOfRenderedNodes++;
}
return $value;
} | php | public function evaluate()
{
$items = $this->getItems();
$value = $this->getInitialValue();
if ($items === null) {
return $value;
}
$this->numberOfRenderedNodes = 0;
$itemName = $this->getItemName();
if ($itemName === null) {
throw new FusionException('The Reduction needs an itemName to be set.', 1537890155);
}
$carryName = $this->getCarryName();
if ($carryName === null) {
throw new FusionException('The Reduction needs an carryName to be set.', 1537890148);
}
$itemKeyName = $this->getItemKey();
$iterationName = $this->getIterationName();
$collectionTotalCount = count($items);
foreach ($items as $itemKey => $item) {
$context = $this->runtime->getCurrentContext();
$context[$itemName] = $item;
$context[$carryName] = $value;
if ($itemKeyName !== null) {
$context[$itemKeyName] = $itemKey;
}
if ($iterationName !== null) {
$context[$iterationName] = $this->prepareIterationInformation($collectionTotalCount);
}
$this->runtime->pushContextArray($context);
$value = $this->runtime->render($this->path . '/itemReducer');
$this->runtime->popContext();
$this->numberOfRenderedNodes++;
}
return $value;
} | [
"public",
"function",
"evaluate",
"(",
")",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"getItems",
"(",
")",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"getInitialValue",
"(",
")",
";",
"if",
"(",
"$",
"items",
"===",
"null",
")",
"{",
"return",
... | Reduce the given items to a single value
@return mixed
@throws FusionException | [
"Reduce",
"the",
"given",
"items",
"to",
"a",
"single",
"value"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/FusionObjects/ReduceImplementation.php#L89-L125 | train |
neos/neos-development-collection | Neos.Neos/Classes/Controller/Service/NodesController.php | NodesController.indexAction | public function indexAction($searchTerm = '', array $nodeIdentifiers = [], $workspaceName = 'live', array $dimensions = [], array $nodeTypes = ['Neos.Neos:Document'], NodeInterface $contextNode = null)
{
$searchableNodeTypeNames = [];
foreach ($nodeTypes as $nodeTypeName) {
if (!$this->nodeTypeManager->hasNodeType($nodeTypeName)) {
$this->throwStatus(400, sprintf('Unknown node type "%s"', $nodeTypeName));
}
$searchableNodeTypeNames[$nodeTypeName] = $nodeTypeName;
/** @var NodeType $subNodeType */
foreach ($this->nodeTypeManager->getSubNodeTypes($nodeTypeName, false) as $subNodeTypeName => $subNodeType) {
$searchableNodeTypeNames[$subNodeTypeName] = $subNodeTypeName;
}
}
$contentContext = $this->createContentContext($workspaceName, $dimensions);
if ($nodeIdentifiers === []) {
$nodes = $this->nodeSearchService->findByProperties($searchTerm, $searchableNodeTypeNames, $contentContext, $contextNode);
} else {
$nodes = array_filter(
array_map(function ($identifier) use ($contentContext) {
return $contentContext->getNodeByIdentifier($identifier);
}, $nodeIdentifiers)
);
}
$this->view->assign('nodes', $nodes);
} | php | public function indexAction($searchTerm = '', array $nodeIdentifiers = [], $workspaceName = 'live', array $dimensions = [], array $nodeTypes = ['Neos.Neos:Document'], NodeInterface $contextNode = null)
{
$searchableNodeTypeNames = [];
foreach ($nodeTypes as $nodeTypeName) {
if (!$this->nodeTypeManager->hasNodeType($nodeTypeName)) {
$this->throwStatus(400, sprintf('Unknown node type "%s"', $nodeTypeName));
}
$searchableNodeTypeNames[$nodeTypeName] = $nodeTypeName;
/** @var NodeType $subNodeType */
foreach ($this->nodeTypeManager->getSubNodeTypes($nodeTypeName, false) as $subNodeTypeName => $subNodeType) {
$searchableNodeTypeNames[$subNodeTypeName] = $subNodeTypeName;
}
}
$contentContext = $this->createContentContext($workspaceName, $dimensions);
if ($nodeIdentifiers === []) {
$nodes = $this->nodeSearchService->findByProperties($searchTerm, $searchableNodeTypeNames, $contentContext, $contextNode);
} else {
$nodes = array_filter(
array_map(function ($identifier) use ($contentContext) {
return $contentContext->getNodeByIdentifier($identifier);
}, $nodeIdentifiers)
);
}
$this->view->assign('nodes', $nodes);
} | [
"public",
"function",
"indexAction",
"(",
"$",
"searchTerm",
"=",
"''",
",",
"array",
"$",
"nodeIdentifiers",
"=",
"[",
"]",
",",
"$",
"workspaceName",
"=",
"'live'",
",",
"array",
"$",
"dimensions",
"=",
"[",
"]",
",",
"array",
"$",
"nodeTypes",
"=",
... | Shows a list of nodes
@param string $searchTerm An optional search term used for filtering the list of nodes
@param array $nodeIdentifiers An optional list of node identifiers
@param string $workspaceName Name of the workspace to search in, "live" by default
@param array $dimensions Optional list of dimensions and their values which should be used for querying
@param array $nodeTypes A list of node types the list should be filtered by
@param NodeInterface $contextNode a node to use as context for the search
@return string | [
"Shows",
"a",
"list",
"of",
"nodes"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Service/NodesController.php#L94-L121 | train |
neos/neos-development-collection | Neos.Neos/Classes/Controller/Service/NodesController.php | NodesController.showAction | public function showAction($identifier, $workspaceName = 'live', array $dimensions = [])
{
$contentContext = $this->createContentContext($workspaceName, $dimensions);
/** @var $node NodeInterface */
$node = $contentContext->getNodeByIdentifier($identifier);
if ($node === null) {
$this->addExistingNodeVariantInformationToResponse($identifier, $contentContext);
$this->throwStatus(404);
}
$convertedNodeProperties = $this->nodePropertyConverterService->getPropertiesArray($node);
array_walk($convertedNodeProperties, function (&$value) {
if (is_array($value)) {
$value = json_encode($value);
}
});
$this->view->assignMultiple([
'node' => $node,
'convertedNodeProperties' => $convertedNodeProperties
]);
} | php | public function showAction($identifier, $workspaceName = 'live', array $dimensions = [])
{
$contentContext = $this->createContentContext($workspaceName, $dimensions);
/** @var $node NodeInterface */
$node = $contentContext->getNodeByIdentifier($identifier);
if ($node === null) {
$this->addExistingNodeVariantInformationToResponse($identifier, $contentContext);
$this->throwStatus(404);
}
$convertedNodeProperties = $this->nodePropertyConverterService->getPropertiesArray($node);
array_walk($convertedNodeProperties, function (&$value) {
if (is_array($value)) {
$value = json_encode($value);
}
});
$this->view->assignMultiple([
'node' => $node,
'convertedNodeProperties' => $convertedNodeProperties
]);
} | [
"public",
"function",
"showAction",
"(",
"$",
"identifier",
",",
"$",
"workspaceName",
"=",
"'live'",
",",
"array",
"$",
"dimensions",
"=",
"[",
"]",
")",
"{",
"$",
"contentContext",
"=",
"$",
"this",
"->",
"createContentContext",
"(",
"$",
"workspaceName",
... | Shows a specific node
@param string $identifier Specifies the node to look up
@param string $workspaceName Name of the workspace to use for querying the node
@param array $dimensions Optional list of dimensions and their values which should be used for querying the specified node
@return string | [
"Shows",
"a",
"specific",
"node"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Service/NodesController.php#L131-L153 | train |
neos/neos-development-collection | Neos.Neos/Classes/Controller/Service/NodesController.php | NodesController.createAction | public function createAction($mode, $identifier, $workspaceName = 'live', array $dimensions = [], array $sourceDimensions = [])
{
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, [
'identifier' => $identifier,
'workspaceName' => $workspaceName,
'dimensions' => $dimensions
]);
} else {
$this->throwStatus(400, sprintf('The create mode "%s" is not supported.', $mode));
}
} | php | public function createAction($mode, $identifier, $workspaceName = 'live', array $dimensions = [], array $sourceDimensions = [])
{
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, [
'identifier' => $identifier,
'workspaceName' => $workspaceName,
'dimensions' => $dimensions
]);
} else {
$this->throwStatus(400, sprintf('The create mode "%s" is not supported.', $mode));
}
} | [
"public",
"function",
"createAction",
"(",
"$",
"mode",
",",
"$",
"identifier",
",",
"$",
"workspaceName",
"=",
"'live'",
",",
"array",
"$",
"dimensions",
"=",
"[",
"]",
",",
"array",
"$",
"sourceDimensions",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
... | Create a new node from an existing one
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
@param string $mode
@param string $identifier Specifies the identifier of the node to be created; if source
@param string $workspaceName Name of the workspace where to create the node in
@param array $dimensions Optional list of dimensions and their values in which the node should be created
@param array $sourceDimensions
@return string | [
"Create",
"a",
"new",
"node",
"from",
"an",
"existing",
"one"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Service/NodesController.php#L171-L193 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Migration/Command/NodeCommandController.php | NodeCommandController.migrateCommand | public function migrateCommand($version, $confirmation = false, $direction = MigrationStatus::DIRECTION_UP)
{
try {
$migrationConfiguration = $direction === MigrationStatus::DIRECTION_UP ?
$this->migrationFactory->getMigrationForVersion($version)->getUpConfiguration() :
$this->migrationFactory->getMigrationForVersion($version)->getDownConfiguration();
$this->outputCommentsAndWarnings($migrationConfiguration);
if ($migrationConfiguration->hasWarnings() && $confirmation === false) {
$this->outputLine();
$this->outputLine('Migration has warnings. You need to confirm execution by adding the "--confirmation true" option to the command.');
$this->quit(1);
}
$nodeMigrationService = new NodeMigration($migrationConfiguration->getMigration());
$nodeMigrationService->execute();
$migrationStatus = new MigrationStatus($version, $direction, new \DateTime());
$this->migrationStatusRepository->add($migrationStatus);
$this->outputLine();
$this->outputLine('Successfully applied migration.');
} catch (MigrationException $e) {
$this->outputLine();
$this->outputLine('Error: ' . $e->getMessage());
$this->quit(1);
} catch (DatabaseException $exception) {
$this->outputLine();
$this->outputLine('An exception occurred during the migration, run a ./flow doctrine:migrate and run the migration again.');
$this->quit(1);
}
} | php | public function migrateCommand($version, $confirmation = false, $direction = MigrationStatus::DIRECTION_UP)
{
try {
$migrationConfiguration = $direction === MigrationStatus::DIRECTION_UP ?
$this->migrationFactory->getMigrationForVersion($version)->getUpConfiguration() :
$this->migrationFactory->getMigrationForVersion($version)->getDownConfiguration();
$this->outputCommentsAndWarnings($migrationConfiguration);
if ($migrationConfiguration->hasWarnings() && $confirmation === false) {
$this->outputLine();
$this->outputLine('Migration has warnings. You need to confirm execution by adding the "--confirmation true" option to the command.');
$this->quit(1);
}
$nodeMigrationService = new NodeMigration($migrationConfiguration->getMigration());
$nodeMigrationService->execute();
$migrationStatus = new MigrationStatus($version, $direction, new \DateTime());
$this->migrationStatusRepository->add($migrationStatus);
$this->outputLine();
$this->outputLine('Successfully applied migration.');
} catch (MigrationException $e) {
$this->outputLine();
$this->outputLine('Error: ' . $e->getMessage());
$this->quit(1);
} catch (DatabaseException $exception) {
$this->outputLine();
$this->outputLine('An exception occurred during the migration, run a ./flow doctrine:migrate and run the migration again.');
$this->quit(1);
}
} | [
"public",
"function",
"migrateCommand",
"(",
"$",
"version",
",",
"$",
"confirmation",
"=",
"false",
",",
"$",
"direction",
"=",
"MigrationStatus",
"::",
"DIRECTION_UP",
")",
"{",
"try",
"{",
"$",
"migrationConfiguration",
"=",
"$",
"direction",
"===",
"Migrat... | Do the configured migrations in the given migration.
By default the up direction is applied, using the direction parameter this can
be changed.
@param string $version The version of the migration configuration you want to use.
@param boolean $confirmation Confirm application of this migration, only needed if the given migration contains any warnings.
@param string $direction The direction to work in, MigrationStatus::DIRECTION_UP or MigrationStatus::DIRECTION_DOWN
@return void
@see neos.contentrepository.migration:node:migrationstatus | [
"Do",
"the",
"configured",
"migrations",
"in",
"the",
"given",
"migration",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Command/NodeCommandController.php#L76-L105 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Migration/Command/NodeCommandController.php | NodeCommandController.migrationStatusCommand | public function migrationStatusCommand()
{
$this->outputLine();
$availableMigrations = $this->migrationFactory->getAvailableMigrationsForCurrentConfigurationType();
if (count($availableMigrations) === 0) {
$this->outputLine('No migrations available.');
$this->quit();
}
$appliedMigrations = $this->migrationStatusRepository->findAll();
$appliedMigrationsDictionary = [];
/** @var $appliedMigration MigrationStatus */
foreach ($appliedMigrations as $appliedMigration) {
$appliedMigrationsDictionary[$appliedMigration->getVersion()][] = $appliedMigration;
}
$tableRows = [];
foreach ($availableMigrations as $version => $migration) {
$migrationUpConfigurationComments = $this->migrationFactory->getMigrationForVersion($version)->getUpConfiguration()->getComments();
if (isset($appliedMigrationsDictionary[$version])) {
$applicationInformation = $this->phraseMigrationApplicationInformation($appliedMigrationsDictionary[$version]);
if ($applicationInformation !== '') {
$migrationUpConfigurationComments .= PHP_EOL . '<b>Applied:</b>' . PHP_EOL . $applicationInformation;
}
}
$tableRows[] = [
$version,
$migration['formattedVersionNumber'],
$migration['package']->getPackageKey(),
wordwrap($migrationUpConfigurationComments, 60)
];
}
$this->outputLine('<b>Available migrations</b>');
$this->outputLine();
$this->output->outputTable($tableRows, ['Version', 'Date', 'Package', 'Comments']);
} | php | public function migrationStatusCommand()
{
$this->outputLine();
$availableMigrations = $this->migrationFactory->getAvailableMigrationsForCurrentConfigurationType();
if (count($availableMigrations) === 0) {
$this->outputLine('No migrations available.');
$this->quit();
}
$appliedMigrations = $this->migrationStatusRepository->findAll();
$appliedMigrationsDictionary = [];
/** @var $appliedMigration MigrationStatus */
foreach ($appliedMigrations as $appliedMigration) {
$appliedMigrationsDictionary[$appliedMigration->getVersion()][] = $appliedMigration;
}
$tableRows = [];
foreach ($availableMigrations as $version => $migration) {
$migrationUpConfigurationComments = $this->migrationFactory->getMigrationForVersion($version)->getUpConfiguration()->getComments();
if (isset($appliedMigrationsDictionary[$version])) {
$applicationInformation = $this->phraseMigrationApplicationInformation($appliedMigrationsDictionary[$version]);
if ($applicationInformation !== '') {
$migrationUpConfigurationComments .= PHP_EOL . '<b>Applied:</b>' . PHP_EOL . $applicationInformation;
}
}
$tableRows[] = [
$version,
$migration['formattedVersionNumber'],
$migration['package']->getPackageKey(),
wordwrap($migrationUpConfigurationComments, 60)
];
}
$this->outputLine('<b>Available migrations</b>');
$this->outputLine();
$this->output->outputTable($tableRows, ['Version', 'Date', 'Package', 'Comments']);
} | [
"public",
"function",
"migrationStatusCommand",
"(",
")",
"{",
"$",
"this",
"->",
"outputLine",
"(",
")",
";",
"$",
"availableMigrations",
"=",
"$",
"this",
"->",
"migrationFactory",
"->",
"getAvailableMigrationsForCurrentConfigurationType",
"(",
")",
";",
"if",
"... | List available and applied migrations
@return void
@see neos.contentrepository.migration:node:migrate | [
"List",
"available",
"and",
"applied",
"migrations"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Command/NodeCommandController.php#L113-L152 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Migration/Command/NodeCommandController.php | NodeCommandController.outputCommentsAndWarnings | protected function outputCommentsAndWarnings(MigrationConfiguration $migrationConfiguration)
{
if ($migrationConfiguration->hasComments()) {
$this->outputLine();
$this->outputLine('<b>Comments</b>');
$this->outputFormatted($migrationConfiguration->getComments(), [], 2);
}
if ($migrationConfiguration->hasWarnings()) {
$this->outputLine();
$this->outputLine('<b><u>Warnings</u></b>');
$this->outputFormatted($migrationConfiguration->getWarnings(), [], 2);
}
} | php | protected function outputCommentsAndWarnings(MigrationConfiguration $migrationConfiguration)
{
if ($migrationConfiguration->hasComments()) {
$this->outputLine();
$this->outputLine('<b>Comments</b>');
$this->outputFormatted($migrationConfiguration->getComments(), [], 2);
}
if ($migrationConfiguration->hasWarnings()) {
$this->outputLine();
$this->outputLine('<b><u>Warnings</u></b>');
$this->outputFormatted($migrationConfiguration->getWarnings(), [], 2);
}
} | [
"protected",
"function",
"outputCommentsAndWarnings",
"(",
"MigrationConfiguration",
"$",
"migrationConfiguration",
")",
"{",
"if",
"(",
"$",
"migrationConfiguration",
"->",
"hasComments",
"(",
")",
")",
"{",
"$",
"this",
"->",
"outputLine",
"(",
")",
";",
"$",
... | Helper to output comments and warnings for the given configuration.
@param MigrationConfiguration $migrationConfiguration
@return void | [
"Helper",
"to",
"output",
"comments",
"and",
"warnings",
"for",
"the",
"given",
"configuration",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Command/NodeCommandController.php#L160-L173 | train |
neos/neos-development-collection | Neos.Media/Classes/TypeConverter/ArrayConverter.php | ArrayConverter.getSourceChildPropertiesToBeConverted | public function getSourceChildPropertiesToBeConverted($source)
{
$sourceChildPropertiesToBeConverted = [
'resource' => $source->getResource()
];
if ($source instanceof AssetVariantInterface) {
$sourceChildPropertiesToBeConverted['originalAsset'] = $source->getOriginalAsset();
}
if ($source instanceof ImageVariant) {
$sourceChildPropertiesToBeConverted['adjustments'] = $source->getAdjustments();
}
return $sourceChildPropertiesToBeConverted;
} | php | public function getSourceChildPropertiesToBeConverted($source)
{
$sourceChildPropertiesToBeConverted = [
'resource' => $source->getResource()
];
if ($source instanceof AssetVariantInterface) {
$sourceChildPropertiesToBeConverted['originalAsset'] = $source->getOriginalAsset();
}
if ($source instanceof ImageVariant) {
$sourceChildPropertiesToBeConverted['adjustments'] = $source->getAdjustments();
}
return $sourceChildPropertiesToBeConverted;
} | [
"public",
"function",
"getSourceChildPropertiesToBeConverted",
"(",
"$",
"source",
")",
"{",
"$",
"sourceChildPropertiesToBeConverted",
"=",
"[",
"'resource'",
"=>",
"$",
"source",
"->",
"getResource",
"(",
")",
"]",
";",
"if",
"(",
"$",
"source",
"instanceof",
... | Return a list of sub-properties inside the source object.
The "key" is the sub-property name, and the "value" is the value of the sub-property.
@param mixed $source
@return array | [
"Return",
"a",
"list",
"of",
"sub",
"-",
"properties",
"inside",
"the",
"source",
"object",
".",
"The",
"key",
"is",
"the",
"sub",
"-",
"property",
"name",
"and",
"the",
"value",
"is",
"the",
"value",
"of",
"the",
"sub",
"-",
"property",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/TypeConverter/ArrayConverter.php#L72-L86 | train |
neos/neos-development-collection | Neos.Fusion/Classes/FusionObjects/Helpers/FusionPathProxy.php | FusionPathProxy.objectAccess | public function objectAccess()
{
if (!$this->fusionRuntime->canRender($this->path)) {
return $this;
}
try {
return $this->fusionRuntime->evaluate($this->path, $this->templateImplementation);
} catch (\Exception $exception) {
return $this->fusionRuntime->handleRenderingException($this->path, $exception);
}
} | php | public function objectAccess()
{
if (!$this->fusionRuntime->canRender($this->path)) {
return $this;
}
try {
return $this->fusionRuntime->evaluate($this->path, $this->templateImplementation);
} catch (\Exception $exception) {
return $this->fusionRuntime->handleRenderingException($this->path, $exception);
}
} | [
"public",
"function",
"objectAccess",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"fusionRuntime",
"->",
"canRender",
"(",
"$",
"this",
"->",
"path",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"try",
"{",
"return",
"$",
"this",
"->",
"fu... | Post-Processor which is called whenever this object is encountered in a Fluid
object access.
Evaluates Fusion objects and eel expressions.
@return FusionPathProxy|mixed
@throws FusionException | [
"Post",
"-",
"Processor",
"which",
"is",
"called",
"whenever",
"this",
"object",
"is",
"encountered",
"in",
"a",
"Fluid",
"object",
"access",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/FusionObjects/Helpers/FusionPathProxy.php#L137-L148 | train |
neos/neos-development-collection | Neos.Fusion/Classes/FusionObjects/Helpers/FusionPathProxy.php | FusionPathProxy.getIterator | public function getIterator()
{
$evaluatedArray = [];
foreach ($this->partialFusionTree as $key => $value) {
if (!is_array($value)) {
$evaluatedArray[$key] = $value;
} elseif (isset($value['__objectType'])) {
$evaluatedArray[$key] = $this->fusionRuntime->evaluate($this->path . '/' . $key);
} elseif (isset($value['__eelExpression'])) {
$evaluatedArray[$key] = $this->fusionRuntime->evaluate($this->path . '/' . $key, $this->templateImplementation);
} else {
$evaluatedArray[$key] = new FusionPathProxy($this->templateImplementation, $this->path . '/' . $key, $this->partialFusionTree[$key]);
}
}
return new \ArrayIterator($evaluatedArray);
} | php | public function getIterator()
{
$evaluatedArray = [];
foreach ($this->partialFusionTree as $key => $value) {
if (!is_array($value)) {
$evaluatedArray[$key] = $value;
} elseif (isset($value['__objectType'])) {
$evaluatedArray[$key] = $this->fusionRuntime->evaluate($this->path . '/' . $key);
} elseif (isset($value['__eelExpression'])) {
$evaluatedArray[$key] = $this->fusionRuntime->evaluate($this->path . '/' . $key, $this->templateImplementation);
} else {
$evaluatedArray[$key] = new FusionPathProxy($this->templateImplementation, $this->path . '/' . $key, $this->partialFusionTree[$key]);
}
}
return new \ArrayIterator($evaluatedArray);
} | [
"public",
"function",
"getIterator",
"(",
")",
"{",
"$",
"evaluatedArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"partialFusionTree",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",... | Iterates through all subelements.
@return \ArrayIterator | [
"Iterates",
"through",
"all",
"subelements",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/FusionObjects/Helpers/FusionPathProxy.php#L155-L170 | train |
neos/neos-development-collection | Neos.Neos/Classes/Controller/Backend/BackendController.php | BackendController.indexAction | public function indexAction()
{
$redirectionUri = $this->backendRedirectionService->getAfterLoginRedirectionUri($this->request);
if ($redirectionUri === null) {
$redirectionUri = $this->uriBuilder->uriFor('index', [], 'Login', 'Neos.Neos');
}
$this->redirectToUri($redirectionUri);
} | php | public function indexAction()
{
$redirectionUri = $this->backendRedirectionService->getAfterLoginRedirectionUri($this->request);
if ($redirectionUri === null) {
$redirectionUri = $this->uriBuilder->uriFor('index', [], 'Login', 'Neos.Neos');
}
$this->redirectToUri($redirectionUri);
} | [
"public",
"function",
"indexAction",
"(",
")",
"{",
"$",
"redirectionUri",
"=",
"$",
"this",
"->",
"backendRedirectionService",
"->",
"getAfterLoginRedirectionUri",
"(",
"$",
"this",
"->",
"request",
")",
";",
"if",
"(",
"$",
"redirectionUri",
"===",
"null",
"... | Default action of the backend controller.
@return void
@throws \Neos\Flow\Mvc\Exception\StopActionException
@throws \Neos\Flow\Mvc\Exception\UnsupportedRequestTypeException
@throws \Neos\Flow\Mvc\Routing\Exception\MissingActionNameException | [
"Default",
"action",
"of",
"the",
"backend",
"controller",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Backend/BackendController.php#L71-L78 | train |
neos/neos-development-collection | Neos.Neos/Classes/Controller/Backend/BackendController.php | BackendController.switchSiteAction | public function switchSiteAction($site)
{
$token = Algorithms::generateRandomToken(32);
$this->loginTokenCache->set($token, $this->currentSession->getId());
$siteUri = $this->linkingService->createSiteUri($this->controllerContext, $site);
$loginUri = $this->controllerContext->getUriBuilder()
->reset()
->uriFor('tokenLogin', ['token' => $token], 'Login', 'Neos.Neos');
$this->redirectToUri($siteUri . $loginUri);
} | php | public function switchSiteAction($site)
{
$token = Algorithms::generateRandomToken(32);
$this->loginTokenCache->set($token, $this->currentSession->getId());
$siteUri = $this->linkingService->createSiteUri($this->controllerContext, $site);
$loginUri = $this->controllerContext->getUriBuilder()
->reset()
->uriFor('tokenLogin', ['token' => $token], 'Login', 'Neos.Neos');
$this->redirectToUri($siteUri . $loginUri);
} | [
"public",
"function",
"switchSiteAction",
"(",
"$",
"site",
")",
"{",
"$",
"token",
"=",
"Algorithms",
"::",
"generateRandomToken",
"(",
"32",
")",
";",
"$",
"this",
"->",
"loginTokenCache",
"->",
"set",
"(",
"$",
"token",
",",
"$",
"this",
"->",
"curren... | Redirects to the Neos backend on the given site, passing a one-time login token
@param Site $site
@return void
@throws \Neos\Cache\Exception
@throws \Neos\Cache\Exception\InvalidDataException
@throws \Neos\Flow\Mvc\Exception\StopActionException
@throws \Neos\Flow\Mvc\Exception\UnsupportedRequestTypeException
@throws \Neos\Flow\Mvc\Routing\Exception\MissingActionNameException
@throws \Neos\Flow\Session\Exception\SessionNotStartedException
@throws \Neos\Neos\Exception | [
"Redirects",
"to",
"the",
"Neos",
"backend",
"on",
"the",
"given",
"site",
"passing",
"a",
"one",
"-",
"time",
"login",
"token"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Backend/BackendController.php#L93-L103 | train |
neos/neos-development-collection | Neos.Neos/Classes/Controller/Backend/BackendController.php | BackendController.xliffAsJsonAction | public function xliffAsJsonAction($locale)
{
$this->response->setHeader('Content-Type', 'application/json');
$this->response->setHeader('Cache-Control', 'max-age=' . (3600 * 24 * 7));
return $this->xliffService->getCachedJson(new Locale($locale));
} | php | public function xliffAsJsonAction($locale)
{
$this->response->setHeader('Content-Type', 'application/json');
$this->response->setHeader('Cache-Control', 'max-age=' . (3600 * 24 * 7));
return $this->xliffService->getCachedJson(new Locale($locale));
} | [
"public",
"function",
"xliffAsJsonAction",
"(",
"$",
"locale",
")",
"{",
"$",
"this",
"->",
"response",
"->",
"setHeader",
"(",
"'Content-Type'",
",",
"'application/json'",
")",
";",
"$",
"this",
"->",
"response",
"->",
"setHeader",
"(",
"'Cache-Control'",
","... | Returns the cached json array with the xliff labels
@param string $locale
@return string
@throws \Neos\Flow\I18n\Exception
@throws \Neos\Flow\I18n\Exception\InvalidLocaleIdentifierException | [
"Returns",
"the",
"cached",
"json",
"array",
"with",
"the",
"xliff",
"labels"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Backend/BackendController.php#L113-L119 | train |
neos/neos-development-collection | Neos.Fusion/Classes/Core/ExceptionHandlers/HtmlMessageHandler.php | HtmlMessageHandler.formatFusionPath | protected function formatFusionPath($fusionPath)
{
$pathSegments = [];
$spacer = '';
foreach (explode('/', $fusionPath) as $segment) {
$pathSegments[] = $spacer . $segment . '/';
$spacer .= ' ';
}
return htmlentities(implode("\n", $pathSegments));
} | php | protected function formatFusionPath($fusionPath)
{
$pathSegments = [];
$spacer = '';
foreach (explode('/', $fusionPath) as $segment) {
$pathSegments[] = $spacer . $segment . '/';
$spacer .= ' ';
}
return htmlentities(implode("\n", $pathSegments));
} | [
"protected",
"function",
"formatFusionPath",
"(",
"$",
"fusionPath",
")",
"{",
"$",
"pathSegments",
"=",
"[",
"]",
";",
"$",
"spacer",
"=",
"''",
";",
"foreach",
"(",
"explode",
"(",
"'/'",
",",
"$",
"fusionPath",
")",
"as",
"$",
"segment",
")",
"{",
... | Renders an indented multi-line stack-trace for the given Fusion path.
example:
default<Neos.Neos:Page>/body<Neos.Fusion:Template>/content/
is rendered as
default<Neos.Neos:Page>/
body<Neos.Fusion:Template>/
content/
@param string $fusionPath
@return string Multi-line stack trace for the given Fusion path | [
"Renders",
"an",
"indented",
"multi",
"-",
"line",
"stack",
"-",
"trace",
"for",
"the",
"given",
"Fusion",
"path",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/ExceptionHandlers/HtmlMessageHandler.php#L123-L132 | train |
neos/neos-development-collection | Neos.Fusion/Classes/Core/ExceptionHandlers/XmlCommentHandler.php | XmlCommentHandler.handle | protected function handle($fusionPath, \Exception $exception, $referenceCode)
{
$logMessage = $this->throwableStorage->logThrowable($exception);
$this->logger->error($logMessage, LogEnvironment::fromMethodName(__METHOD__));
if (isset($referenceCode)) {
return sprintf(
'<!-- Exception while rendering %s: %s (%s) -->',
$this->formatScriptPath($fusionPath, ''),
htmlspecialchars($exception->getMessage()),
$referenceCode
);
} else {
return sprintf(
'<!-- Exception while rendering %s: %s -->',
$this->formatScriptPath($fusionPath, ''),
htmlspecialchars($exception->getMessage())
);
}
} | php | protected function handle($fusionPath, \Exception $exception, $referenceCode)
{
$logMessage = $this->throwableStorage->logThrowable($exception);
$this->logger->error($logMessage, LogEnvironment::fromMethodName(__METHOD__));
if (isset($referenceCode)) {
return sprintf(
'<!-- Exception while rendering %s: %s (%s) -->',
$this->formatScriptPath($fusionPath, ''),
htmlspecialchars($exception->getMessage()),
$referenceCode
);
} else {
return sprintf(
'<!-- Exception while rendering %s: %s -->',
$this->formatScriptPath($fusionPath, ''),
htmlspecialchars($exception->getMessage())
);
}
} | [
"protected",
"function",
"handle",
"(",
"$",
"fusionPath",
",",
"\\",
"Exception",
"$",
"exception",
",",
"$",
"referenceCode",
")",
"{",
"$",
"logMessage",
"=",
"$",
"this",
"->",
"throwableStorage",
"->",
"logThrowable",
"(",
"$",
"exception",
")",
";",
... | Provides an XML comment containing the exception
@param string $fusionPath path causing the exception
@param \Exception $exception exception to handle
@param integer $referenceCode
@return string | [
"Provides",
"an",
"XML",
"comment",
"containing",
"the",
"exception"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/ExceptionHandlers/XmlCommentHandler.php#L57-L75 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Model/NodeData.php | NodeData.setPath | public function setPath($path, $recursive = true)
{
if (!is_string($path) || preg_match(NodeInterface::MATCH_PATTERN_PATH, $path) !== 1) {
throw new \InvalidArgumentException('Invalid path "' . $path . '" (a path must be a valid string, be absolute (starting with a slash) and contain only the allowed characters).', 1284369857);
}
if ($path === $this->path) {
return;
}
if ($recursive === true) {
foreach ($this->getChildNodeData() as $childNodeData) {
$childNodeData->setPath(NodePaths::addNodePathSegment($path, $childNodeData->getName()));
}
}
$pathBeforeChange = $this->path;
$this->path = $path;
$this->calculatePathHash();
$this->parentPath = NodePaths::getParentPath($path);
$this->calculateParentPathHash();
$this->depth = NodePaths::getPathDepth($path);
if ($pathBeforeChange !== null) {
// this method is called both for changing the path AND in the constructor of Node; so we only want to do
// these things below if called OUTSIDE a constructor.
$this->emitNodePathChanged($this);
$this->addOrUpdate();
}
} | php | public function setPath($path, $recursive = true)
{
if (!is_string($path) || preg_match(NodeInterface::MATCH_PATTERN_PATH, $path) !== 1) {
throw new \InvalidArgumentException('Invalid path "' . $path . '" (a path must be a valid string, be absolute (starting with a slash) and contain only the allowed characters).', 1284369857);
}
if ($path === $this->path) {
return;
}
if ($recursive === true) {
foreach ($this->getChildNodeData() as $childNodeData) {
$childNodeData->setPath(NodePaths::addNodePathSegment($path, $childNodeData->getName()));
}
}
$pathBeforeChange = $this->path;
$this->path = $path;
$this->calculatePathHash();
$this->parentPath = NodePaths::getParentPath($path);
$this->calculateParentPathHash();
$this->depth = NodePaths::getPathDepth($path);
if ($pathBeforeChange !== null) {
// this method is called both for changing the path AND in the constructor of Node; so we only want to do
// these things below if called OUTSIDE a constructor.
$this->emitNodePathChanged($this);
$this->addOrUpdate();
}
} | [
"public",
"function",
"setPath",
"(",
"$",
"path",
",",
"$",
"recursive",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"path",
")",
"||",
"preg_match",
"(",
"NodeInterface",
"::",
"MATCH_PATTERN_PATH",
",",
"$",
"path",
")",
"!==",
"1"... | Sets the absolute path of this node
@param string $path
@param boolean $recursive
@return void
@throws \InvalidArgumentException if the given node path is invalid. | [
"Sets",
"the",
"absolute",
"path",
"of",
"this",
"node"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeData.php#L275-L305 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Model/NodeData.php | NodeData.createSingleNodeData | public function createSingleNodeData($name, NodeType $nodeType = null, $identifier = null, Workspace $workspace = null, array $dimensions = null)
{
if (!is_string($name) || preg_match(NodeInterface::MATCH_PATTERN_NAME, $name) !== 1) {
throw new \InvalidArgumentException('Invalid node name "' . $name . '" (a node name must only contain lowercase characters, numbers and the "-" sign).', 1292428697);
}
$nodeWorkspace = $workspace ?: $this->workspace;
$newPath = NodePaths::addNodePathSegment($this->path, $name);
if ($this->nodeDataRepository->findOneByPath($newPath, $nodeWorkspace, $dimensions, null) !== null) {
throw new NodeExistsException(sprintf('Node with path "' . $newPath . '" already exists in workspace %s and given dimensions %s.', $nodeWorkspace->getName(), var_export($dimensions, true)), 1292503471);
}
$newNodeData = new NodeData($newPath, $nodeWorkspace, $identifier, $dimensions);
if ($nodeType !== null) {
$newNodeData->setNodeType($nodeType);
}
$this->nodeDataRepository->setNewIndex($newNodeData, NodeDataRepository::POSITION_LAST);
return $newNodeData;
} | php | public function createSingleNodeData($name, NodeType $nodeType = null, $identifier = null, Workspace $workspace = null, array $dimensions = null)
{
if (!is_string($name) || preg_match(NodeInterface::MATCH_PATTERN_NAME, $name) !== 1) {
throw new \InvalidArgumentException('Invalid node name "' . $name . '" (a node name must only contain lowercase characters, numbers and the "-" sign).', 1292428697);
}
$nodeWorkspace = $workspace ?: $this->workspace;
$newPath = NodePaths::addNodePathSegment($this->path, $name);
if ($this->nodeDataRepository->findOneByPath($newPath, $nodeWorkspace, $dimensions, null) !== null) {
throw new NodeExistsException(sprintf('Node with path "' . $newPath . '" already exists in workspace %s and given dimensions %s.', $nodeWorkspace->getName(), var_export($dimensions, true)), 1292503471);
}
$newNodeData = new NodeData($newPath, $nodeWorkspace, $identifier, $dimensions);
if ($nodeType !== null) {
$newNodeData->setNodeType($nodeType);
}
$this->nodeDataRepository->setNewIndex($newNodeData, NodeDataRepository::POSITION_LAST);
return $newNodeData;
} | [
"public",
"function",
"createSingleNodeData",
"(",
"$",
"name",
",",
"NodeType",
"$",
"nodeType",
"=",
"null",
",",
"$",
"identifier",
"=",
"null",
",",
"Workspace",
"$",
"workspace",
"=",
"null",
",",
"array",
"$",
"dimensions",
"=",
"null",
")",
"{",
"... | Creates, adds and returns a child node of this node, without setting default
properties or creating subnodes.
@param string $name Name of the new node
@param NodeType $nodeType Node type of the new node (optional)
@param string $identifier The identifier of the node, unique within the workspace, optional(!)
@param Workspace $workspace
@param array $dimensions An array of dimension name to dimension values
@throws NodeExistsException if a node with this path already exists.
@throws \InvalidArgumentException if the node name is not accepted.
@return NodeData | [
"Creates",
"adds",
"and",
"returns",
"a",
"child",
"node",
"of",
"this",
"node",
"without",
"setting",
"default",
"properties",
"or",
"creating",
"subnodes",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeData.php#L482-L501 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Model/NodeData.php | NodeData.getChildNodeData | protected function getChildNodeData()
{
return array_filter(
$this->nodeDataRepository->findByParentWithoutReduce($this->path, $this->workspace),
function ($childNodeData) {
return $childNodeData->dimensionsHash === $this->dimensionsHash;
}
);
} | php | protected function getChildNodeData()
{
return array_filter(
$this->nodeDataRepository->findByParentWithoutReduce($this->path, $this->workspace),
function ($childNodeData) {
return $childNodeData->dimensionsHash === $this->dimensionsHash;
}
);
} | [
"protected",
"function",
"getChildNodeData",
"(",
")",
"{",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"nodeDataRepository",
"->",
"findByParentWithoutReduce",
"(",
"$",
"this",
"->",
"path",
",",
"$",
"this",
"->",
"workspace",
")",
",",
"function",
"(... | Returns all direct child node data of this node data with reducing the result by dimensionHash only
Only used internally for setting the path of all child nodes.
@return \Neos\ContentRepository\Domain\Model\NodeData[] | [
"Returns",
"all",
"direct",
"child",
"node",
"data",
"of",
"this",
"node",
"data",
"with",
"reducing",
"the",
"result",
"by",
"dimensionHash",
"only"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeData.php#L543-L551 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Model/NodeData.php | NodeData.isAccessible | public function isAccessible()
{
if ($this->hasAccessRestrictions() === false) {
return true;
}
if ($this->securityContext->canBeInitialized() === false) {
return true;
}
foreach ($this->accessRoles as $roleName) {
if ($this->securityContext->hasRole($roleName)) {
return true;
}
}
return false;
} | php | public function isAccessible()
{
if ($this->hasAccessRestrictions() === false) {
return true;
}
if ($this->securityContext->canBeInitialized() === false) {
return true;
}
foreach ($this->accessRoles as $roleName) {
if ($this->securityContext->hasRole($roleName)) {
return true;
}
}
return false;
} | [
"public",
"function",
"isAccessible",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasAccessRestrictions",
"(",
")",
"===",
"false",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"securityContext",
"->",
"canBeInitialized",
"(",
")... | Tells if this node may be accessed according to the current security context.
@return boolean | [
"Tells",
"if",
"this",
"node",
"may",
"be",
"accessed",
"according",
"to",
"the",
"current",
"security",
"context",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeData.php#L622-L639 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Model/NodeData.php | NodeData.hasAccessRestrictions | public function hasAccessRestrictions()
{
if (!is_array($this->accessRoles) || empty($this->accessRoles)) {
return false;
}
if (count($this->accessRoles) === 1 && in_array('Neos.Flow:Everybody', $this->accessRoles)) {
return false;
}
return true;
} | php | public function hasAccessRestrictions()
{
if (!is_array($this->accessRoles) || empty($this->accessRoles)) {
return false;
}
if (count($this->accessRoles) === 1 && in_array('Neos.Flow:Everybody', $this->accessRoles)) {
return false;
}
return true;
} | [
"public",
"function",
"hasAccessRestrictions",
"(",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"accessRoles",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"accessRoles",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"count",
... | Tells if a node, in general, has access restrictions, independent of the
current security context.
@return boolean | [
"Tells",
"if",
"a",
"node",
"in",
"general",
"has",
"access",
"restrictions",
"independent",
"of",
"the",
"current",
"security",
"context",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeData.php#L647-L657 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Model/NodeData.php | NodeData.setDimensions | public function setDimensions(array $dimensionsToBeSet)
{
if ($this->dimensions->count() === 0) {
$this->dimensions = new ArrayCollection($dimensionsToBeSet);
$this->buildDimensionValues();
return;
}
$expectedDimensions = [];
/** @var NodeDimension $dimensionToBeSet */
foreach ($dimensionsToBeSet as $dimensionToBeSet) {
$dimensionToBeSet->setNodeData($this);
$existingDimension = $this->findExistingDimensionMatching($dimensionToBeSet);
$expectedDimensions[] = $existingDimension !== null ? $existingDimension : $dimensionToBeSet;
if ($existingDimension === null) {
$this->dimensions->add($dimensionToBeSet);
}
}
// remove entries not to be set
$dimensionsToRemove = $this->dimensions->filter(function (NodeDimension $dimension) use ($expectedDimensions) {
return (array_search($dimension, $expectedDimensions) === false);
});
foreach ($dimensionsToRemove as $dimension) {
$this->dimensions->removeElement($dimension);
}
$this->buildDimensionValues();
} | php | public function setDimensions(array $dimensionsToBeSet)
{
if ($this->dimensions->count() === 0) {
$this->dimensions = new ArrayCollection($dimensionsToBeSet);
$this->buildDimensionValues();
return;
}
$expectedDimensions = [];
/** @var NodeDimension $dimensionToBeSet */
foreach ($dimensionsToBeSet as $dimensionToBeSet) {
$dimensionToBeSet->setNodeData($this);
$existingDimension = $this->findExistingDimensionMatching($dimensionToBeSet);
$expectedDimensions[] = $existingDimension !== null ? $existingDimension : $dimensionToBeSet;
if ($existingDimension === null) {
$this->dimensions->add($dimensionToBeSet);
}
}
// remove entries not to be set
$dimensionsToRemove = $this->dimensions->filter(function (NodeDimension $dimension) use ($expectedDimensions) {
return (array_search($dimension, $expectedDimensions) === false);
});
foreach ($dimensionsToRemove as $dimension) {
$this->dimensions->removeElement($dimension);
}
$this->buildDimensionValues();
} | [
"public",
"function",
"setDimensions",
"(",
"array",
"$",
"dimensionsToBeSet",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dimensions",
"->",
"count",
"(",
")",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"dimensions",
"=",
"new",
"ArrayCollection",
"(",
"$",
... | Internal use, do not manipulate collection directly
@param array <NodeDimension> $dimensionsToBeSet
@return void | [
"Internal",
"use",
"do",
"not",
"manipulate",
"collection",
"directly"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeData.php#L675-L704 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Model/NodeData.php | NodeData.similarize | public function similarize(AbstractNodeData $sourceNode, $isCopy = false)
{
$this->properties = [];
foreach ($sourceNode->getProperties() as $propertyName => $propertyValue) {
$this->setProperty($propertyName, $propertyValue);
}
$propertyNames = [
'nodeType',
'hidden',
'hiddenAfterDateTime',
'hiddenBeforeDateTime',
'hiddenInIndex',
'accessRoles'
];
if (!$isCopy) {
$propertyNames[] = 'creationDateTime';
$propertyNames[] = 'lastModificationDateTime';
}
if ($sourceNode instanceof NodeData) {
$propertyNames[] = 'index';
}
foreach ($propertyNames as $propertyName) {
ObjectAccess::setProperty($this, $propertyName, ObjectAccess::getProperty($sourceNode, $propertyName));
}
$contentObject = $sourceNode->getContentObject();
if ($contentObject !== null) {
$this->setContentObject($contentObject);
}
} | php | public function similarize(AbstractNodeData $sourceNode, $isCopy = false)
{
$this->properties = [];
foreach ($sourceNode->getProperties() as $propertyName => $propertyValue) {
$this->setProperty($propertyName, $propertyValue);
}
$propertyNames = [
'nodeType',
'hidden',
'hiddenAfterDateTime',
'hiddenBeforeDateTime',
'hiddenInIndex',
'accessRoles'
];
if (!$isCopy) {
$propertyNames[] = 'creationDateTime';
$propertyNames[] = 'lastModificationDateTime';
}
if ($sourceNode instanceof NodeData) {
$propertyNames[] = 'index';
}
foreach ($propertyNames as $propertyName) {
ObjectAccess::setProperty($this, $propertyName, ObjectAccess::getProperty($sourceNode, $propertyName));
}
$contentObject = $sourceNode->getContentObject();
if ($contentObject !== null) {
$this->setContentObject($contentObject);
}
} | [
"public",
"function",
"similarize",
"(",
"AbstractNodeData",
"$",
"sourceNode",
",",
"$",
"isCopy",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"properties",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"sourceNode",
"->",
"getProperties",
"(",
")",
"as",
"$"... | Make the node "similar" to the given source node. That means,
- all properties
- index
- node type
- content object
will be set to the same values as in the source node.
@param AbstractNodeData $sourceNode
@param boolean $isCopy
@return void | [
"Make",
"the",
"node",
"similar",
"to",
"the",
"given",
"source",
"node",
".",
"That",
"means",
"-",
"all",
"properties",
"-",
"index",
"-",
"node",
"type",
"-",
"content",
"object",
"will",
"be",
"set",
"to",
"the",
"same",
"values",
"as",
"in",
"the"... | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeData.php#L753-L783 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Model/NodeData.php | NodeData.buildDimensionValues | protected function buildDimensionValues()
{
$dimensionValues = [];
foreach ($this->dimensions as $dimension) {
/** @var NodeDimension $dimension */
$dimensionValues[$dimension->getName()][] = $dimension->getValue();
}
$this->dimensionsHash = Utility::sortDimensionValueArrayAndReturnDimensionsHash($dimensionValues);
$this->dimensionValues = $dimensionValues;
} | php | protected function buildDimensionValues()
{
$dimensionValues = [];
foreach ($this->dimensions as $dimension) {
/** @var NodeDimension $dimension */
$dimensionValues[$dimension->getName()][] = $dimension->getValue();
}
$this->dimensionsHash = Utility::sortDimensionValueArrayAndReturnDimensionsHash($dimensionValues);
$this->dimensionValues = $dimensionValues;
} | [
"protected",
"function",
"buildDimensionValues",
"(",
")",
"{",
"$",
"dimensionValues",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"dimensions",
"as",
"$",
"dimension",
")",
"{",
"/** @var NodeDimension $dimension */",
"$",
"dimensionValues",
"[",
"$... | Build a cached array of dimension values and a hash to search for it.
@return void | [
"Build",
"a",
"cached",
"array",
"of",
"dimension",
"values",
"and",
"a",
"hash",
"to",
"search",
"for",
"it",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeData.php#L800-L809 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Model/NodeData.php | NodeData.matchesWorkspaceAndDimensions | public function matchesWorkspaceAndDimensions($workspace, array $dimensions = null)
{
if ($this->workspace->getName() !== $workspace->getName()) {
return false;
}
if ($dimensions !== null) {
$nodeDimensionValues = $this->dimensionValues;
foreach ($dimensions as $dimensionName => $dimensionValues) {
if (isset($nodeDimensionValues[$dimensionName]) && $nodeDimensionValues[$dimensionName] !== [] && array_intersect($nodeDimensionValues[$dimensionName], $dimensionValues) === []) {
return false;
}
}
}
return true;
} | php | public function matchesWorkspaceAndDimensions($workspace, array $dimensions = null)
{
if ($this->workspace->getName() !== $workspace->getName()) {
return false;
}
if ($dimensions !== null) {
$nodeDimensionValues = $this->dimensionValues;
foreach ($dimensions as $dimensionName => $dimensionValues) {
if (isset($nodeDimensionValues[$dimensionName]) && $nodeDimensionValues[$dimensionName] !== [] && array_intersect($nodeDimensionValues[$dimensionName], $dimensionValues) === []) {
return false;
}
}
}
return true;
} | [
"public",
"function",
"matchesWorkspaceAndDimensions",
"(",
"$",
"workspace",
",",
"array",
"$",
"dimensions",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"workspace",
"->",
"getName",
"(",
")",
"!==",
"$",
"workspace",
"->",
"getName",
"(",
")",
... | Checks if this instance matches the given workspace and dimensions.
@param Workspace $workspace
@param array $dimensions
@return boolean | [
"Checks",
"if",
"this",
"instance",
"matches",
"the",
"given",
"workspace",
"and",
"dimensions",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeData.php#L830-L845 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Model/NodeData.php | NodeData.createShadow | public function createShadow($path)
{
$shadowNode = new NodeData($path, $this->workspace, $this->identifier, $this->dimensionValues);
$shadowNode->similarize($this);
$shadowNode->setAsShadowOf($this);
return $shadowNode;
} | php | public function createShadow($path)
{
$shadowNode = new NodeData($path, $this->workspace, $this->identifier, $this->dimensionValues);
$shadowNode->similarize($this);
$shadowNode->setAsShadowOf($this);
return $shadowNode;
} | [
"public",
"function",
"createShadow",
"(",
"$",
"path",
")",
"{",
"$",
"shadowNode",
"=",
"new",
"NodeData",
"(",
"$",
"path",
",",
"$",
"this",
"->",
"workspace",
",",
"$",
"this",
"->",
"identifier",
",",
"$",
"this",
"->",
"dimensionValues",
")",
";... | Create a shadow NodeData at the given path with the same workspace and dimensions as this
Note: The constructor will already add the new object to the repository
Internal method, do not use outside of the content repository.
@param string $path The (original) path for the node data
@return NodeData | [
"Create",
"a",
"shadow",
"NodeData",
"at",
"the",
"given",
"path",
"with",
"the",
"same",
"workspace",
"and",
"dimensions",
"as",
"this"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeData.php#L991-L998 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Model/NodeData.php | NodeData.setAsShadowOf | protected function setAsShadowOf(NodeData $nodeData = null)
{
$this->setMovedTo($nodeData);
$this->setRemoved(($nodeData !== null));
$this->addOrUpdate();
} | php | protected function setAsShadowOf(NodeData $nodeData = null)
{
$this->setMovedTo($nodeData);
$this->setRemoved(($nodeData !== null));
$this->addOrUpdate();
} | [
"protected",
"function",
"setAsShadowOf",
"(",
"NodeData",
"$",
"nodeData",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setMovedTo",
"(",
"$",
"nodeData",
")",
";",
"$",
"this",
"->",
"setRemoved",
"(",
"(",
"$",
"nodeData",
"!==",
"null",
")",
")",
";"... | This becomes a shdow of the given NodeData object.
If NULL or no argument is given then movedTo is nulled and removed is set to false effectively turning this into a normal NodeData.
@param NodeData $nodeData
@return void | [
"This",
"becomes",
"a",
"shdow",
"of",
"the",
"given",
"NodeData",
"object",
".",
"If",
"NULL",
"or",
"no",
"argument",
"is",
"given",
"then",
"movedTo",
"is",
"nulled",
"and",
"removed",
"is",
"set",
"to",
"false",
"effectively",
"turning",
"this",
"into"... | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeData.php#L1007-L1012 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Model/NodeData.php | NodeData.addOrUpdate | protected function addOrUpdate(NodeData $nodeData = null)
{
$nodeData = ($nodeData === null ? $this : $nodeData);
// If this NodeData was previously removed and is in live workspace we don't want to add it again to persistence.
if ($nodeData->isRemoved() && $this->workspace->getBaseWorkspace() === null) {
// Actually it should be removed from the identity map here.
if ($this->persistenceManager->isNewObject($nodeData) === false) {
$this->nodeDataRepository->remove($nodeData);
}
return;
}
// If the node is marked to be removed but didn't exist in a base workspace yet, we can delete it for real, without creating a shadow node.
// This optimization cannot be made for shadow nodes which are moved.
if ($nodeData->isRemoved() && $nodeData->getMovedTo() === null && $this->nodeDataRepository->findOneByIdentifier($nodeData->getIdentifier(), $this->workspace->getBaseWorkspace()) === null) {
if ($this->persistenceManager->isNewObject($nodeData) === false) {
$this->nodeDataRepository->remove($nodeData);
}
return;
}
if ($this->persistenceManager->isNewObject($nodeData)) {
$this->nodeDataRepository->add($nodeData);
} else {
$this->nodeDataRepository->update($nodeData);
}
} | php | protected function addOrUpdate(NodeData $nodeData = null)
{
$nodeData = ($nodeData === null ? $this : $nodeData);
// If this NodeData was previously removed and is in live workspace we don't want to add it again to persistence.
if ($nodeData->isRemoved() && $this->workspace->getBaseWorkspace() === null) {
// Actually it should be removed from the identity map here.
if ($this->persistenceManager->isNewObject($nodeData) === false) {
$this->nodeDataRepository->remove($nodeData);
}
return;
}
// If the node is marked to be removed but didn't exist in a base workspace yet, we can delete it for real, without creating a shadow node.
// This optimization cannot be made for shadow nodes which are moved.
if ($nodeData->isRemoved() && $nodeData->getMovedTo() === null && $this->nodeDataRepository->findOneByIdentifier($nodeData->getIdentifier(), $this->workspace->getBaseWorkspace()) === null) {
if ($this->persistenceManager->isNewObject($nodeData) === false) {
$this->nodeDataRepository->remove($nodeData);
}
return;
}
if ($this->persistenceManager->isNewObject($nodeData)) {
$this->nodeDataRepository->add($nodeData);
} else {
$this->nodeDataRepository->update($nodeData);
}
} | [
"protected",
"function",
"addOrUpdate",
"(",
"NodeData",
"$",
"nodeData",
"=",
"null",
")",
"{",
"$",
"nodeData",
"=",
"(",
"$",
"nodeData",
"===",
"null",
"?",
"$",
"this",
":",
"$",
"nodeData",
")",
";",
"// If this NodeData was previously removed and is in li... | Adds this node to the Node Repository or updates it if it has been added earlier
@param NodeData $nodeData Other NodeData object to addOrUpdate
@throws IllegalObjectTypeException | [
"Adds",
"this",
"node",
"to",
"the",
"Node",
"Repository",
"or",
"updates",
"it",
"if",
"it",
"has",
"been",
"added",
"earlier"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeData.php#L1039-L1066 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/MenuItemsImplementation.php | MenuItemsImplementation.getMaximumLevels | public function getMaximumLevels()
{
if ($this->maximumLevels === null) {
$this->maximumLevels = $this->fusionValue('maximumLevels');
if ($this->maximumLevels > self::MAXIMUM_LEVELS_LIMIT) {
$this->maximumLevels = self::MAXIMUM_LEVELS_LIMIT;
}
}
return $this->maximumLevels;
} | php | public function getMaximumLevels()
{
if ($this->maximumLevels === null) {
$this->maximumLevels = $this->fusionValue('maximumLevels');
if ($this->maximumLevels > self::MAXIMUM_LEVELS_LIMIT) {
$this->maximumLevels = self::MAXIMUM_LEVELS_LIMIT;
}
}
return $this->maximumLevels;
} | [
"public",
"function",
"getMaximumLevels",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"maximumLevels",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"maximumLevels",
"=",
"$",
"this",
"->",
"fusionValue",
"(",
"'maximumLevels'",
")",
";",
"if",
"(",
"$",
... | Maximum number of levels which should be rendered in this menu.
@return integer | [
"Maximum",
"number",
"of",
"levels",
"which",
"should",
"be",
"rendered",
"in",
"this",
"menu",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/MenuItemsImplementation.php#L86-L96 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/MenuItemsImplementation.php | MenuItemsImplementation.getLastLevel | public function getLastLevel()
{
if ($this->lastLevel === null) {
$this->lastLevel = $this->fusionValue('lastLevel');
if ($this->lastLevel > self::MAXIMUM_LEVELS_LIMIT) {
$this->lastLevel = self::MAXIMUM_LEVELS_LIMIT;
}
}
return $this->lastLevel;
} | php | public function getLastLevel()
{
if ($this->lastLevel === null) {
$this->lastLevel = $this->fusionValue('lastLevel');
if ($this->lastLevel > self::MAXIMUM_LEVELS_LIMIT) {
$this->lastLevel = self::MAXIMUM_LEVELS_LIMIT;
}
}
return $this->lastLevel;
} | [
"public",
"function",
"getLastLevel",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"lastLevel",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"lastLevel",
"=",
"$",
"this",
"->",
"fusionValue",
"(",
"'lastLevel'",
")",
";",
"if",
"(",
"$",
"this",
"->"... | Return evaluated lastLevel value.
@return integer | [
"Return",
"evaluated",
"lastLevel",
"value",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/MenuItemsImplementation.php#L103-L113 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/MenuItemsImplementation.php | MenuItemsImplementation.buildItems | protected function buildItems()
{
$items = [];
if ($this->getItemCollection() !== null) {
$menuLevelCollection = $this->getItemCollection();
} else {
$entryParentNode = $this->findMenuStartingPoint();
if ($entryParentNode === null) {
return $items;
}
$menuLevelCollection = $entryParentNode->getChildNodes($this->getFilter());
}
$items = $this->buildMenuLevelRecursive($menuLevelCollection);
return $items;
} | php | protected function buildItems()
{
$items = [];
if ($this->getItemCollection() !== null) {
$menuLevelCollection = $this->getItemCollection();
} else {
$entryParentNode = $this->findMenuStartingPoint();
if ($entryParentNode === null) {
return $items;
}
$menuLevelCollection = $entryParentNode->getChildNodes($this->getFilter());
}
$items = $this->buildMenuLevelRecursive($menuLevelCollection);
return $items;
} | [
"protected",
"function",
"buildItems",
"(",
")",
"{",
"$",
"items",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"getItemCollection",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"menuLevelCollection",
"=",
"$",
"this",
"->",
"getItemCollection",
"(",
... | Builds the array of menu items containing those items which match the
configuration set for this Menu object.
@throws FusionException
@return array An array of menu items and further information | [
"Builds",
"the",
"array",
"of",
"menu",
"items",
"containing",
"those",
"items",
"which",
"match",
"the",
"configuration",
"set",
"for",
"this",
"Menu",
"object",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/MenuItemsImplementation.php#L142-L159 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/MenuItemsImplementation.php | MenuItemsImplementation.buildMenuItemRecursive | protected function buildMenuItemRecursive(NodeInterface $currentNode)
{
if ($this->isNodeHidden($currentNode)) {
return null;
}
$item = [
'node' => $currentNode,
'state' => self::STATE_NORMAL,
'label' => $currentNode->getLabel(),
'menuLevel' => $this->currentLevel
];
$item['state'] = $this->calculateItemState($currentNode);
if (!$this->isOnLastLevelOfMenu($currentNode)) {
$this->currentLevel++;
$item['subItems'] = $this->buildMenuLevelRecursive($currentNode->getChildNodes($this->getFilter()));
$this->currentLevel--;
}
return $item;
} | php | protected function buildMenuItemRecursive(NodeInterface $currentNode)
{
if ($this->isNodeHidden($currentNode)) {
return null;
}
$item = [
'node' => $currentNode,
'state' => self::STATE_NORMAL,
'label' => $currentNode->getLabel(),
'menuLevel' => $this->currentLevel
];
$item['state'] = $this->calculateItemState($currentNode);
if (!$this->isOnLastLevelOfMenu($currentNode)) {
$this->currentLevel++;
$item['subItems'] = $this->buildMenuLevelRecursive($currentNode->getChildNodes($this->getFilter()));
$this->currentLevel--;
}
return $item;
} | [
"protected",
"function",
"buildMenuItemRecursive",
"(",
"NodeInterface",
"$",
"currentNode",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNodeHidden",
"(",
"$",
"currentNode",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"item",
"=",
"[",
"'node'",
"=>",
... | Prepare the menu item with state and sub items if this isn't the last menu level.
@param NodeInterface $currentNode
@return array | [
"Prepare",
"the",
"menu",
"item",
"with",
"state",
"and",
"sub",
"items",
"if",
"this",
"isn",
"t",
"the",
"last",
"menu",
"level",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/MenuItemsImplementation.php#L186-L207 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/MenuItemsImplementation.php | MenuItemsImplementation.findMenuStartingPoint | protected function findMenuStartingPoint()
{
$fusionContext = $this->runtime->getCurrentContext();
$startingPoint = $this->getStartingPoint();
if (!isset($fusionContext['node']) && !$startingPoint) {
throw new FusionException('You must either set a "startingPoint" for the menu or "node" must be set in the Fusion context.', 1369596980);
}
$startingPoint = $startingPoint ? : $fusionContext['node'];
$entryParentNode = $this->findParentNodeInBreadcrumbPathByLevel($this->getEntryLevel(), $startingPoint);
return $entryParentNode;
} | php | protected function findMenuStartingPoint()
{
$fusionContext = $this->runtime->getCurrentContext();
$startingPoint = $this->getStartingPoint();
if (!isset($fusionContext['node']) && !$startingPoint) {
throw new FusionException('You must either set a "startingPoint" for the menu or "node" must be set in the Fusion context.', 1369596980);
}
$startingPoint = $startingPoint ? : $fusionContext['node'];
$entryParentNode = $this->findParentNodeInBreadcrumbPathByLevel($this->getEntryLevel(), $startingPoint);
return $entryParentNode;
} | [
"protected",
"function",
"findMenuStartingPoint",
"(",
")",
"{",
"$",
"fusionContext",
"=",
"$",
"this",
"->",
"runtime",
"->",
"getCurrentContext",
"(",
")",
";",
"$",
"startingPoint",
"=",
"$",
"this",
"->",
"getStartingPoint",
"(",
")",
";",
"if",
"(",
... | Find the starting point for this menu. depending on given startingPoint
If startingPoint is given, this is taken as starting point for this menu level,
as a fallback the Fusion context variable node is used.
If entryLevel is configured this will be taken into account as well.
@return NodeInterface
@throws Exception | [
"Find",
"the",
"starting",
"point",
"for",
"this",
"menu",
".",
"depending",
"on",
"given",
"startingPoint",
"If",
"startingPoint",
"is",
"given",
"this",
"is",
"taken",
"as",
"starting",
"point",
"for",
"this",
"menu",
"level",
"as",
"a",
"fallback",
"the",... | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/MenuItemsImplementation.php#L219-L231 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/MenuItemsImplementation.php | MenuItemsImplementation.isOnLastLevelOfMenu | protected function isOnLastLevelOfMenu(NodeInterface $menuItemNode)
{
if ($this->currentLevel >= $this->getMaximumLevels()) {
return true;
}
if (($this->getLastLevel() !== null)) {
if ($this->getNodeLevelInSite($menuItemNode) >= $this->calculateNodeDepthFromRelativeLevel($this->getLastLevel(), $this->currentNode)) {
return true;
}
}
return false;
} | php | protected function isOnLastLevelOfMenu(NodeInterface $menuItemNode)
{
if ($this->currentLevel >= $this->getMaximumLevels()) {
return true;
}
if (($this->getLastLevel() !== null)) {
if ($this->getNodeLevelInSite($menuItemNode) >= $this->calculateNodeDepthFromRelativeLevel($this->getLastLevel(), $this->currentNode)) {
return true;
}
}
return false;
} | [
"protected",
"function",
"isOnLastLevelOfMenu",
"(",
"NodeInterface",
"$",
"menuItemNode",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currentLevel",
">=",
"$",
"this",
"->",
"getMaximumLevels",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"(",
... | Checks if the given menuItem is on the last level for this menu, either defined by maximumLevels or lastLevels.
@param NodeInterface $menuItemNode
@return boolean | [
"Checks",
"if",
"the",
"given",
"menuItem",
"is",
"on",
"the",
"last",
"level",
"for",
"this",
"menu",
"either",
"defined",
"by",
"maximumLevels",
"or",
"lastLevels",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/MenuItemsImplementation.php#L239-L252 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/MenuItemsImplementation.php | MenuItemsImplementation.findParentNodeInBreadcrumbPathByLevel | protected function findParentNodeInBreadcrumbPathByLevel($givenSiteLevel, NodeInterface $startingPoint)
{
$parentNode = null;
if ($givenSiteLevel === 0) {
return $startingPoint;
}
$absoluteDepth = $this->calculateNodeDepthFromRelativeLevel($givenSiteLevel, $startingPoint);
if (($absoluteDepth - 1) > $this->getNodeLevelInSite($startingPoint)) {
return null;
}
$currentSiteNode = $this->currentNode->getContext()->getCurrentSiteNode();
$breadcrumbNodes = $currentSiteNode->getContext()->getNodesOnPath($currentSiteNode, $startingPoint);
if (isset($breadcrumbNodes[$absoluteDepth - 1])) {
$parentNode = $breadcrumbNodes[$absoluteDepth - 1];
}
return $parentNode;
} | php | protected function findParentNodeInBreadcrumbPathByLevel($givenSiteLevel, NodeInterface $startingPoint)
{
$parentNode = null;
if ($givenSiteLevel === 0) {
return $startingPoint;
}
$absoluteDepth = $this->calculateNodeDepthFromRelativeLevel($givenSiteLevel, $startingPoint);
if (($absoluteDepth - 1) > $this->getNodeLevelInSite($startingPoint)) {
return null;
}
$currentSiteNode = $this->currentNode->getContext()->getCurrentSiteNode();
$breadcrumbNodes = $currentSiteNode->getContext()->getNodesOnPath($currentSiteNode, $startingPoint);
if (isset($breadcrumbNodes[$absoluteDepth - 1])) {
$parentNode = $breadcrumbNodes[$absoluteDepth - 1];
}
return $parentNode;
} | [
"protected",
"function",
"findParentNodeInBreadcrumbPathByLevel",
"(",
"$",
"givenSiteLevel",
",",
"NodeInterface",
"$",
"startingPoint",
")",
"{",
"$",
"parentNode",
"=",
"null",
";",
"if",
"(",
"$",
"givenSiteLevel",
"===",
"0",
")",
"{",
"return",
"$",
"start... | Finds the node in the current breadcrumb path between current site node and
current node whose level matches the specified entry level.
@param integer $givenSiteLevel The site level child nodes of the to be found parent node should have. See $this->entryLevel for possible values.
@param NodeInterface $startingPoint
@return NodeInterface The parent node of the node at the specified level or NULL if none was found | [
"Finds",
"the",
"node",
"in",
"the",
"current",
"breadcrumb",
"path",
"between",
"current",
"site",
"node",
"and",
"current",
"node",
"whose",
"level",
"matches",
"the",
"specified",
"entry",
"level",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/MenuItemsImplementation.php#L262-L282 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/MenuItemsImplementation.php | MenuItemsImplementation.calculateNodeDepthFromRelativeLevel | protected function calculateNodeDepthFromRelativeLevel($relativeLevel, NodeInterface $referenceNode)
{
if ($relativeLevel > 0) {
$depth = $relativeLevel;
} else {
$currentSiteDepth = $this->getNodeLevelInSite($referenceNode);
if ($currentSiteDepth + $relativeLevel < 1) {
$depth = 1;
} else {
$depth = $currentSiteDepth + $relativeLevel + 1;
}
}
return $depth;
} | php | protected function calculateNodeDepthFromRelativeLevel($relativeLevel, NodeInterface $referenceNode)
{
if ($relativeLevel > 0) {
$depth = $relativeLevel;
} else {
$currentSiteDepth = $this->getNodeLevelInSite($referenceNode);
if ($currentSiteDepth + $relativeLevel < 1) {
$depth = 1;
} else {
$depth = $currentSiteDepth + $relativeLevel + 1;
}
}
return $depth;
} | [
"protected",
"function",
"calculateNodeDepthFromRelativeLevel",
"(",
"$",
"relativeLevel",
",",
"NodeInterface",
"$",
"referenceNode",
")",
"{",
"if",
"(",
"$",
"relativeLevel",
">",
"0",
")",
"{",
"$",
"depth",
"=",
"$",
"relativeLevel",
";",
"}",
"else",
"{"... | Calculates an absolute depth value for a relative level given.
@param integer $relativeLevel
@param NodeInterface $referenceNode
@return integer | [
"Calculates",
"an",
"absolute",
"depth",
"value",
"for",
"a",
"relative",
"level",
"given",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/MenuItemsImplementation.php#L291-L305 | train |
neos/neos-development-collection | Neos.Media/Classes/Domain/Repository/ThumbnailRepository.php | ThumbnailRepository.findAllIterator | public function findAllIterator($configurationHash = null)
{
/** @var QueryBuilder $queryBuilder */
$queryBuilder = $this->entityManager->createQueryBuilder();
$queryBuilder
->select('t')
->from($this->getEntityClassName(), 't');
if ($configurationHash !== null) {
$queryBuilder
->where('t.configurationHash = :configurationHash')
->setParameter('configurationHash', $configurationHash);
}
return $queryBuilder->getQuery()->iterate();
} | php | public function findAllIterator($configurationHash = null)
{
/** @var QueryBuilder $queryBuilder */
$queryBuilder = $this->entityManager->createQueryBuilder();
$queryBuilder
->select('t')
->from($this->getEntityClassName(), 't');
if ($configurationHash !== null) {
$queryBuilder
->where('t.configurationHash = :configurationHash')
->setParameter('configurationHash', $configurationHash);
}
return $queryBuilder->getQuery()->iterate();
} | [
"public",
"function",
"findAllIterator",
"(",
"$",
"configurationHash",
"=",
"null",
")",
"{",
"/** @var QueryBuilder $queryBuilder */",
"$",
"queryBuilder",
"=",
"$",
"this",
"->",
"entityManager",
"->",
"createQueryBuilder",
"(",
")",
";",
"$",
"queryBuilder",
"->... | Find all objects and return an IterableResult
@param string $configurationHash Optional filtering by configuration hash (preset)
@return IterableResult | [
"Find",
"all",
"objects",
"and",
"return",
"an",
"IterableResult"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Repository/ThumbnailRepository.php#L66-L79 | train |
neos/neos-development-collection | Neos.Media/Classes/Domain/Repository/ThumbnailRepository.php | ThumbnailRepository.countUngenerated | public function countUngenerated()
{
$query = $this->createQuery();
$query->matching($query->logicalAnd($query->equals('resource', null), $query->equals('staticResource', null)));
return $query->count();
} | php | public function countUngenerated()
{
$query = $this->createQuery();
$query->matching($query->logicalAnd($query->equals('resource', null), $query->equals('staticResource', null)));
return $query->count();
} | [
"public",
"function",
"countUngenerated",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"createQuery",
"(",
")",
";",
"$",
"query",
"->",
"matching",
"(",
"$",
"query",
"->",
"logicalAnd",
"(",
"$",
"query",
"->",
"equals",
"(",
"'resource'",
",... | Count ungenerated objects
@return integer | [
"Count",
"ungenerated",
"objects"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Repository/ThumbnailRepository.php#L102-L107 | train |
neos/neos-development-collection | Neos.Media/Classes/Domain/Repository/ThumbnailRepository.php | ThumbnailRepository.findOneByAssetAndThumbnailConfiguration | public function findOneByAssetAndThumbnailConfiguration(AssetInterface $asset, ThumbnailConfiguration $configuration)
{
/**
* @var $query \Doctrine\ORM\Query
*/
$query = $this->entityManager->createQuery('SELECT t FROM Neos\Media\Domain\Model\Thumbnail t WHERE t.originalAsset = :originalAsset AND t.configurationHash = :configurationHash');
$query->setParameter('originalAsset', $this->persistenceManager->getIdentifierByObject($asset));
$query->setParameter('configurationHash', $configuration->getHash());
$query->setMaxResults(1);
$result = $query->getOneOrNullResult();
return $result;
} | php | public function findOneByAssetAndThumbnailConfiguration(AssetInterface $asset, ThumbnailConfiguration $configuration)
{
/**
* @var $query \Doctrine\ORM\Query
*/
$query = $this->entityManager->createQuery('SELECT t FROM Neos\Media\Domain\Model\Thumbnail t WHERE t.originalAsset = :originalAsset AND t.configurationHash = :configurationHash');
$query->setParameter('originalAsset', $this->persistenceManager->getIdentifierByObject($asset));
$query->setParameter('configurationHash', $configuration->getHash());
$query->setMaxResults(1);
$result = $query->getOneOrNullResult();
return $result;
} | [
"public",
"function",
"findOneByAssetAndThumbnailConfiguration",
"(",
"AssetInterface",
"$",
"asset",
",",
"ThumbnailConfiguration",
"$",
"configuration",
")",
"{",
"/**\n * @var $query \\Doctrine\\ORM\\Query\n */",
"$",
"query",
"=",
"$",
"this",
"->",
"entit... | Returns a thumbnail of the given asset with the specified dimensions.
@param AssetInterface $asset The asset to render a thumbnail for
@param ThumbnailConfiguration $configuration
@return \Neos\Media\Domain\Model\Thumbnail The thumbnail or NULL | [
"Returns",
"a",
"thumbnail",
"of",
"the",
"given",
"asset",
"with",
"the",
"specified",
"dimensions",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Repository/ThumbnailRepository.php#L116-L129 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Migration/Filters/Workspace.php | Workspace.matches | public function matches(NodeData $node)
{
return $node->getWorkspace() !== null && $node->getWorkspace()->getName() === $this->workspaceName;
} | php | public function matches(NodeData $node)
{
return $node->getWorkspace() !== null && $node->getWorkspace()->getName() === $this->workspaceName;
} | [
"public",
"function",
"matches",
"(",
"NodeData",
"$",
"node",
")",
"{",
"return",
"$",
"node",
"->",
"getWorkspace",
"(",
")",
"!==",
"null",
"&&",
"$",
"node",
"->",
"getWorkspace",
"(",
")",
"->",
"getName",
"(",
")",
"===",
"$",
"this",
"->",
"wo... | Returns true if the given node is in the workspace this filter expects.
@param NodeData $node
@return boolean | [
"Returns",
"true",
"if",
"the",
"given",
"node",
"is",
"in",
"the",
"workspace",
"this",
"filter",
"expects",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Filters/Workspace.php#L45-L48 | train |
neos/neos-development-collection | Neos.Neos/Classes/Command/UserCommandController.php | UserCommandController.listCommand | public function listCommand()
{
$users = $this->userService->getUsers();
$tableRows = [];
$headerRow = ['Name', 'Email', 'Account(s)', 'Role(s)', 'Active'];
foreach ($users as $user) {
$tableRows[] = $this->getTableRowForUser($user);
}
$this->output->outputTable($tableRows, $headerRow);
} | php | public function listCommand()
{
$users = $this->userService->getUsers();
$tableRows = [];
$headerRow = ['Name', 'Email', 'Account(s)', 'Role(s)', 'Active'];
foreach ($users as $user) {
$tableRows[] = $this->getTableRowForUser($user);
}
$this->output->outputTable($tableRows, $headerRow);
} | [
"public",
"function",
"listCommand",
"(",
")",
"{",
"$",
"users",
"=",
"$",
"this",
"->",
"userService",
"->",
"getUsers",
"(",
")",
";",
"$",
"tableRows",
"=",
"[",
"]",
";",
"$",
"headerRow",
"=",
"[",
"'Name'",
",",
"'Email'",
",",
"'Account(s)'",
... | List all users
This command lists all existing Neos users.
@return void | [
"List",
"all",
"users"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/UserCommandController.php#L49-L61 | train |
neos/neos-development-collection | Neos.Neos/Classes/Command/UserCommandController.php | UserCommandController.showCommand | public function showCommand($username, $authenticationProvider = null)
{
$user = $this->userService->getUser($username, $authenticationProvider);
if (!$user instanceof User) {
$this->outputLine('The username "%s" is not in use', [$username]);
$this->quit(1);
}
$headerRow = ['Name', 'Email', 'Account(s)', 'Role(s)', 'Active'];
$tableRows = [$this->getTableRowForUser($user)];
$this->output->outputTable($tableRows, $headerRow);
} | php | public function showCommand($username, $authenticationProvider = null)
{
$user = $this->userService->getUser($username, $authenticationProvider);
if (!$user instanceof User) {
$this->outputLine('The username "%s" is not in use', [$username]);
$this->quit(1);
}
$headerRow = ['Name', 'Email', 'Account(s)', 'Role(s)', 'Active'];
$tableRows = [$this->getTableRowForUser($user)];
$this->output->outputTable($tableRows, $headerRow);
} | [
"public",
"function",
"showCommand",
"(",
"$",
"username",
",",
"$",
"authenticationProvider",
"=",
"null",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"userService",
"->",
"getUser",
"(",
"$",
"username",
",",
"$",
"authenticationProvider",
")",
";",
"... | Shows the given user
This command shows some basic details about the given user. If such a user does not exist, this command
will exit with a non-zero status code.
The user will be retrieved by looking for a Neos backend account with the given identifier (ie. the username)
and then retrieving the user which owns that account. If an authentication provider is specified, this command
will look for an account identified by "username" for that specific provider.
@param string $username The username of the user to show. Usually refers to the account identifier of the user's Neos backend account.
@param string $authenticationProvider Name of the authentication provider to use. Example: "Neos.Neos:Backend"
@return void | [
"Shows",
"the",
"given",
"user"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/UserCommandController.php#L77-L89 | train |
neos/neos-development-collection | Neos.Neos/Classes/Command/UserCommandController.php | UserCommandController.setPasswordCommand | public function setPasswordCommand($username, $password, $authenticationProvider = null)
{
$user = $this->userService->getUser($username, $authenticationProvider);
if (!$user instanceof User) {
$this->outputLine('The user "%s" does not exist.', [$username]);
$this->quit(1);
}
$this->userService->setUserPassword($user, $password);
$this->outputLine('The new password for user "%s" was set.', [$username]);
} | php | public function setPasswordCommand($username, $password, $authenticationProvider = null)
{
$user = $this->userService->getUser($username, $authenticationProvider);
if (!$user instanceof User) {
$this->outputLine('The user "%s" does not exist.', [$username]);
$this->quit(1);
}
$this->userService->setUserPassword($user, $password);
$this->outputLine('The new password for user "%s" was set.', [$username]);
} | [
"public",
"function",
"setPasswordCommand",
"(",
"$",
"username",
",",
"$",
"password",
",",
"$",
"authenticationProvider",
"=",
"null",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"userService",
"->",
"getUser",
"(",
"$",
"username",
",",
"$",
"authent... | Set a new password for the given user
This command sets a new password for an existing user. More specifically, all accounts related to the user
which are based on a username / password token will receive the new password.
If an authentication provider was specified, the user will be determined by an account identified by "username"
related to the given provider.
@param string $username Username of the user to modify
@param string $password The new password
@param string $authenticationProvider Name of the authentication provider to use for finding the user. Example: "Neos.Neos:Backend"
@return void | [
"Set",
"a",
"new",
"password",
"for",
"the",
"given",
"user"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/UserCommandController.php#L263-L272 | train |
neos/neos-development-collection | Neos.Neos/Classes/Command/UserCommandController.php | UserCommandController.addRoleCommand | public function addRoleCommand($username, $role, $authenticationProvider = null)
{
$users = $this->findUsersByUsernamePattern($username, $authenticationProvider);
if (empty($users)) {
$this->outputLine('No users that match name-pattern "%s" do exist.', [$username]);
$this->quit(1);
}
foreach ($users as $user) {
$username = $this->userService->getUsername($user, $authenticationProvider);
try {
if ($this->userService->addRoleToUser($user, $role) > 0) {
$this->outputLine('Added role "%s" to accounts of user "%s".', [$role, $username]);
} else {
$this->outputLine('User "%s" already had the role "%s" assigned.', [$username, $role]);
}
} catch (NoSuchRoleException $exception) {
$this->outputLine('The role "%s" does not exist.', [$role]);
$this->quit(2);
}
}
} | php | public function addRoleCommand($username, $role, $authenticationProvider = null)
{
$users = $this->findUsersByUsernamePattern($username, $authenticationProvider);
if (empty($users)) {
$this->outputLine('No users that match name-pattern "%s" do exist.', [$username]);
$this->quit(1);
}
foreach ($users as $user) {
$username = $this->userService->getUsername($user, $authenticationProvider);
try {
if ($this->userService->addRoleToUser($user, $role) > 0) {
$this->outputLine('Added role "%s" to accounts of user "%s".', [$role, $username]);
} else {
$this->outputLine('User "%s" already had the role "%s" assigned.', [$username, $role]);
}
} catch (NoSuchRoleException $exception) {
$this->outputLine('The role "%s" does not exist.', [$role]);
$this->quit(2);
}
}
} | [
"public",
"function",
"addRoleCommand",
"(",
"$",
"username",
",",
"$",
"role",
",",
"$",
"authenticationProvider",
"=",
"null",
")",
"{",
"$",
"users",
"=",
"$",
"this",
"->",
"findUsersByUsernamePattern",
"(",
"$",
"username",
",",
"$",
"authenticationProvid... | Add a role to a user
This command allows for adding a specific role to an existing user.
Roles can optionally be specified as a comma separated list. For all roles provided by Neos, the role
namespace "Neos.Neos:" can be omitted.
If an authentication provider was specified, the user will be determined by an account identified by "username"
related to the given provider. However, once a user has been found, the new role will be added to <b>all</b>
existing accounts related to that user, regardless of its authentication provider.
@param string $username The username of the user (globbing is supported)
@param string $role Role to be added to the user, for example "Neos.Neos:Administrator" or just "Administrator"
@param string $authenticationProvider Name of the authentication provider to use. Example: "Neos.Neos:Backend"
@return void | [
"Add",
"a",
"role",
"to",
"a",
"user"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/UserCommandController.php#L291-L312 | train |
neos/neos-development-collection | Neos.Neos/Classes/Command/UserCommandController.php | UserCommandController.findUsersByUsernamePattern | protected function findUsersByUsernamePattern($usernamePattern, $authenticationProviderName = null)
{
if (preg_match('/[\\?\\*\\{\\[]/u', $usernamePattern)) {
return array_filter(
$this->userService->getUsers()->toArray(),
function ($user) use ($usernamePattern, $authenticationProviderName) {
return fnmatch($usernamePattern, $this->userService->getUsername($user, $authenticationProviderName));
}
);
} else {
$user = $this->userService->getUser($usernamePattern, $authenticationProviderName);
if ($user instanceof User) {
return [$user];
}
}
return [];
} | php | protected function findUsersByUsernamePattern($usernamePattern, $authenticationProviderName = null)
{
if (preg_match('/[\\?\\*\\{\\[]/u', $usernamePattern)) {
return array_filter(
$this->userService->getUsers()->toArray(),
function ($user) use ($usernamePattern, $authenticationProviderName) {
return fnmatch($usernamePattern, $this->userService->getUsername($user, $authenticationProviderName));
}
);
} else {
$user = $this->userService->getUser($usernamePattern, $authenticationProviderName);
if ($user instanceof User) {
return [$user];
}
}
return [];
} | [
"protected",
"function",
"findUsersByUsernamePattern",
"(",
"$",
"usernamePattern",
",",
"$",
"authenticationProviderName",
"=",
"null",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/[\\\\?\\\\*\\\\{\\\\[]/u'",
",",
"$",
"usernamePattern",
")",
")",
"{",
"return",
"arr... | Find all users the match the given username with globbing support
@param string $usernamePattern pattern for the username of the users to find
@param string $authenticationProviderName Name of the authentication provider to use
@return array<User> | [
"Find",
"all",
"users",
"the",
"match",
"the",
"given",
"username",
"with",
"globbing",
"support"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/UserCommandController.php#L358-L374 | train |
neos/neos-development-collection | Neos.Neos/Classes/Command/UserCommandController.php | UserCommandController.getTableRowForUser | protected function getTableRowForUser(User $user)
{
$roleNames = [];
$accountIdentifiers = [];
foreach ($user->getAccounts() as $account) {
/** @var Account $account */
$authenticationProviderName = $account->getAuthenticationProviderName();
if ($authenticationProviderName !== $this->userService->getDefaultAuthenticationProviderName()) {
$authenticationProviderLabel = ' (' . (isset($this->authenticationProviderSettings[$authenticationProviderName]['label']) ? $this->authenticationProviderSettings[$authenticationProviderName]['label'] : $authenticationProviderName) . ')';
} else {
$authenticationProviderLabel = '';
}
$accountIdentifiers[] = $account->getAccountIdentifier() . $authenticationProviderLabel;
foreach ($account->getRoles() as $role) {
/** @var Role $role */
$roleNames[] = $role->getIdentifier();
}
}
return [$user->getName()->getFullName(), $user->getPrimaryElectronicAddress(), implode(', ', $accountIdentifiers), implode(', ', $roleNames), ($user->isActive() ? 'yes' : 'no')];
} | php | protected function getTableRowForUser(User $user)
{
$roleNames = [];
$accountIdentifiers = [];
foreach ($user->getAccounts() as $account) {
/** @var Account $account */
$authenticationProviderName = $account->getAuthenticationProviderName();
if ($authenticationProviderName !== $this->userService->getDefaultAuthenticationProviderName()) {
$authenticationProviderLabel = ' (' . (isset($this->authenticationProviderSettings[$authenticationProviderName]['label']) ? $this->authenticationProviderSettings[$authenticationProviderName]['label'] : $authenticationProviderName) . ')';
} else {
$authenticationProviderLabel = '';
}
$accountIdentifiers[] = $account->getAccountIdentifier() . $authenticationProviderLabel;
foreach ($account->getRoles() as $role) {
/** @var Role $role */
$roleNames[] = $role->getIdentifier();
}
}
return [$user->getName()->getFullName(), $user->getPrimaryElectronicAddress(), implode(', ', $accountIdentifiers), implode(', ', $roleNames), ($user->isActive() ? 'yes' : 'no')];
} | [
"protected",
"function",
"getTableRowForUser",
"(",
"User",
"$",
"user",
")",
"{",
"$",
"roleNames",
"=",
"[",
"]",
";",
"$",
"accountIdentifiers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"user",
"->",
"getAccounts",
"(",
")",
"as",
"$",
"account",
")... | Prepares a table row for output with data of the given User
@param User $user The user
@return array | [
"Prepares",
"a",
"table",
"row",
"for",
"output",
"with",
"data",
"of",
"the",
"given",
"User"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/UserCommandController.php#L382-L401 | train |
neos/neos-development-collection | Neos.Media/Classes/Domain/Model/Thumbnail.php | Thumbnail.initializeObject | public function initializeObject($initializationCause)
{
if ($initializationCause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) {
if ($this->async === false) {
$this->refresh();
}
}
} | php | public function initializeObject($initializationCause)
{
if ($initializationCause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) {
if ($this->async === false) {
$this->refresh();
}
}
} | [
"public",
"function",
"initializeObject",
"(",
"$",
"initializationCause",
")",
"{",
"if",
"(",
"$",
"initializationCause",
"===",
"ObjectManagerInterface",
"::",
"INITIALIZATIONCAUSE_CREATED",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"async",
"===",
"false",
")",
... | Initializes this thumbnail
@param integer $initializationCause
@return void | [
"Initializes",
"this",
"thumbnail"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/Thumbnail.php#L107-L114 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Migration/Service/NodeFilter.php | NodeFilter.getFilterExpressions | public function getFilterExpressions(array $filterConfigurations, Query $baseQuery): array
{
$filterExpressions = [];
foreach ($filterConfigurations as $filterConfiguration) {
$filterObject = $this->constructFilterObject($filterConfiguration);
if ($filterObject instanceof DoctrineFilterInterface) {
foreach ($filterObject->getFilterExpressions($baseQuery) as $filterExpression) {
$filterExpressions[] = $filterExpression;
}
}
}
return $filterExpressions;
} | php | public function getFilterExpressions(array $filterConfigurations, Query $baseQuery): array
{
$filterExpressions = [];
foreach ($filterConfigurations as $filterConfiguration) {
$filterObject = $this->constructFilterObject($filterConfiguration);
if ($filterObject instanceof DoctrineFilterInterface) {
foreach ($filterObject->getFilterExpressions($baseQuery) as $filterExpression) {
$filterExpressions[] = $filterExpression;
}
}
}
return $filterExpressions;
} | [
"public",
"function",
"getFilterExpressions",
"(",
"array",
"$",
"filterConfigurations",
",",
"Query",
"$",
"baseQuery",
")",
":",
"array",
"{",
"$",
"filterExpressions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"filterConfigurations",
"as",
"$",
"filterConfigur... | Return array with Doctrine expressions
@param array $filterConfigurations
@param Query $baseQuery
@return array
@throws MigrationException | [
"Return",
"array",
"with",
"Doctrine",
"expressions"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Service/NodeFilter.php#L48-L60 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Migration/Service/NodeFilter.php | NodeFilter.matchFilters | public function matchFilters(NodeData $nodeData, array $filterConfiguration)
{
$filterConjunction = $this->buildFilterConjunction($filterConfiguration);
foreach ($filterConjunction as $filter) {
if (!$filter->matches($nodeData)) {
return false;
}
}
return true;
} | php | public function matchFilters(NodeData $nodeData, array $filterConfiguration)
{
$filterConjunction = $this->buildFilterConjunction($filterConfiguration);
foreach ($filterConjunction as $filter) {
if (!$filter->matches($nodeData)) {
return false;
}
}
return true;
} | [
"public",
"function",
"matchFilters",
"(",
"NodeData",
"$",
"nodeData",
",",
"array",
"$",
"filterConfiguration",
")",
"{",
"$",
"filterConjunction",
"=",
"$",
"this",
"->",
"buildFilterConjunction",
"(",
"$",
"filterConfiguration",
")",
";",
"foreach",
"(",
"$"... | Apply local filters to result.
@param NodeData $nodeData
@param array $filterConfiguration
@return boolean
@throws MigrationException | [
"Apply",
"local",
"filters",
"to",
"result",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Service/NodeFilter.php#L70-L79 | train |
neos/neos-development-collection | Neos.Neos/Classes/Utility/BackendAssetsUtility.php | BackendAssetsUtility.shouldLoadMinifiedJavascript | public function shouldLoadMinifiedJavascript()
{
if (isset($this->settings['userInterface']['loadMinifiedJavaScript'])) {
return $this->settings['userInterface']['loadMinifiedJavaScript'];
} elseif (isset($this->settings['userInterface']['loadMinifiedJavascript'])) {
return $this->settings['userInterface']['loadMinifiedJavascript'];
}
return true;
} | php | public function shouldLoadMinifiedJavascript()
{
if (isset($this->settings['userInterface']['loadMinifiedJavaScript'])) {
return $this->settings['userInterface']['loadMinifiedJavaScript'];
} elseif (isset($this->settings['userInterface']['loadMinifiedJavascript'])) {
return $this->settings['userInterface']['loadMinifiedJavascript'];
}
return true;
} | [
"public",
"function",
"shouldLoadMinifiedJavascript",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"settings",
"[",
"'userInterface'",
"]",
"[",
"'loadMinifiedJavaScript'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"settings",
"[",
"'use... | Returns true if the minified Neos JavaScript sources should be loaded, false otherwise.
@return boolean | [
"Returns",
"true",
"if",
"the",
"minified",
"Neos",
"JavaScript",
"sources",
"should",
"be",
"loaded",
"false",
"otherwise",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Utility/BackendAssetsUtility.php#L39-L47 | train |
neos/neos-development-collection | Neos.Media/Classes/Validator/ImageTypeValidator.php | ImageTypeValidator.validateOptions | protected function validateOptions()
{
if (!isset($this->options['allowedTypes'])) {
throw new InvalidValidationOptionsException('The option "allowedTypes" was not specified.', 1327947194);
} elseif (!is_array($this->options['allowedTypes']) || $this->options['allowedTypes'] === []) {
throw new InvalidValidationOptionsException('The option "allowedTypes" must be an array with at least one item.', 1327947224);
}
} | php | protected function validateOptions()
{
if (!isset($this->options['allowedTypes'])) {
throw new InvalidValidationOptionsException('The option "allowedTypes" was not specified.', 1327947194);
} elseif (!is_array($this->options['allowedTypes']) || $this->options['allowedTypes'] === []) {
throw new InvalidValidationOptionsException('The option "allowedTypes" must be an array with at least one item.', 1327947224);
}
} | [
"protected",
"function",
"validateOptions",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'allowedTypes'",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidValidationOptionsException",
"(",
"'The option \"allowedTypes\" was not specifie... | Checks if this validator is correctly configured
@return void
@throws InvalidValidationOptionsException if the configured validation options are incorrect | [
"Checks",
"if",
"this",
"validator",
"is",
"correctly",
"configured"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Validator/ImageTypeValidator.php#L69-L76 | train |
neos/neos-development-collection | Neos.Media.Browser/Classes/Domain/ImageMapper.php | ImageMapper.mapImage | private function mapImage(): array
{
$previewUri = $this->resourceManager->getPublicPersistentResourceUri($this->image->getResource());
return [
'previewUri' => $previewUri,
'width' => $this->image->getWidth(),
'height' => $this->image->getHeight(),
'persistenceIdentifier' => $this->persistenceManager->getIdentifierByObject($this->image)
];
} | php | private function mapImage(): array
{
$previewUri = $this->resourceManager->getPublicPersistentResourceUri($this->image->getResource());
return [
'previewUri' => $previewUri,
'width' => $this->image->getWidth(),
'height' => $this->image->getHeight(),
'persistenceIdentifier' => $this->persistenceManager->getIdentifierByObject($this->image)
];
} | [
"private",
"function",
"mapImage",
"(",
")",
":",
"array",
"{",
"$",
"previewUri",
"=",
"$",
"this",
"->",
"resourceManager",
"->",
"getPublicPersistentResourceUri",
"(",
"$",
"this",
"->",
"image",
"->",
"getResource",
"(",
")",
")",
";",
"return",
"[",
"... | Map the image object attached to this mapper to basic properties.
@return array | [
"Map",
"the",
"image",
"object",
"attached",
"to",
"this",
"mapper",
"to",
"basic",
"properties",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Domain/ImageMapper.php#L87-L97 | train |
neos/neos-development-collection | Neos.Media.Browser/Classes/Domain/ImageMapper.php | ImageMapper.mapCrop | private function mapCrop(ImageVariant $imageVariant, CropImageAdjustment $adjustment)
{
$variantInformation['hasCrop'] = true;
$variantInformation['cropInformation'] = [
'width' => $adjustment->getWidth(),
'height' => $adjustment->getHeight(),
'x' => $adjustment->getX(),
'y' => $adjustment->getY(),
];
$aspectRatio = $adjustment->getAspectRatio();
if ($aspectRatio !== null) {
[$x, $y, $width, $height] = CropImageAdjustment::calculateDimensionsByAspectRatio($imageVariant->getOriginalAsset()->getWidth(), $imageVariant->getOriginalAsset()->getHeight(), $aspectRatio);
$variantInformation['cropInformation'] = [
'width' => $width,
'height' => $height,
'x' => $x,
'y' => $y,
];
}
return $variantInformation;
} | php | private function mapCrop(ImageVariant $imageVariant, CropImageAdjustment $adjustment)
{
$variantInformation['hasCrop'] = true;
$variantInformation['cropInformation'] = [
'width' => $adjustment->getWidth(),
'height' => $adjustment->getHeight(),
'x' => $adjustment->getX(),
'y' => $adjustment->getY(),
];
$aspectRatio = $adjustment->getAspectRatio();
if ($aspectRatio !== null) {
[$x, $y, $width, $height] = CropImageAdjustment::calculateDimensionsByAspectRatio($imageVariant->getOriginalAsset()->getWidth(), $imageVariant->getOriginalAsset()->getHeight(), $aspectRatio);
$variantInformation['cropInformation'] = [
'width' => $width,
'height' => $height,
'x' => $x,
'y' => $y,
];
}
return $variantInformation;
} | [
"private",
"function",
"mapCrop",
"(",
"ImageVariant",
"$",
"imageVariant",
",",
"CropImageAdjustment",
"$",
"adjustment",
")",
"{",
"$",
"variantInformation",
"[",
"'hasCrop'",
"]",
"=",
"true",
";",
"$",
"variantInformation",
"[",
"'cropInformation'",
"]",
"=",
... | Map crop information for user interface.
@param ImageVariant $imageVariant
@param CropImageAdjustment $adjustment
@return array | [
"Map",
"crop",
"information",
"for",
"user",
"interface",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Domain/ImageMapper.php#L128-L150 | train |
neos/neos-development-collection | Neos.Neos/Classes/Fusion/PluginViewImplementation.php | PluginViewImplementation.buildPluginRequest | protected function buildPluginRequest()
{
/** @var $parentRequest ActionRequest */
$parentRequest = $this->runtime->getControllerContext()->getRequest();
$pluginRequest = new ActionRequest($parentRequest);
if (!$this->pluginViewNode instanceof NodeInterface) {
$pluginRequest->setArgumentNamespace('--' . $this->getPluginNamespace());
$this->passArgumentsToPluginRequest($pluginRequest);
$pluginRequest->setControllerPackageKey($this->getPackage());
$pluginRequest->setControllerSubpackageKey($this->getSubpackage());
$pluginRequest->setControllerName($this->getController());
$pluginRequest->setControllerActionName($this->getAction());
return $pluginRequest;
}
$pluginNodeIdentifier = $this->pluginViewNode->getProperty('plugin');
if (strlen($pluginNodeIdentifier) === 0) {
return $pluginRequest;
}
// Set the node to render this to the master plugin node
$this->node = $this->pluginViewNode->getContext()->getNodeByIdentifier($pluginNodeIdentifier);
if ($this->node === null) {
return $pluginRequest;
}
$pluginRequest->setArgument('__node', $this->node);
$pluginRequest->setArgumentNamespace('--' . $this->getPluginNamespace());
$this->passArgumentsToPluginRequest($pluginRequest);
if ($pluginRequest->getControllerObjectName() !== '') {
return $pluginRequest;
}
$controllerObjectPairs = [];
$pluginViewName = $this->pluginViewNode->getProperty('view');
foreach ($this->pluginService->getPluginViewDefinitionsByPluginNodeType($this->node->getNodeType()) as $pluginViewDefinition) {
/** @var PluginViewDefinition $pluginViewDefinition */
if ($pluginViewDefinition->getName() !== $pluginViewName) {
continue;
}
$controllerObjectPairs = $pluginViewDefinition->getControllerActionPairs();
break;
}
if ($controllerObjectPairs === []) {
return $pluginRequest;
}
$defaultControllerObjectName = key($controllerObjectPairs);
$defaultActionName = current($controllerObjectPairs[$defaultControllerObjectName]);
$pluginRequest->setControllerObjectName($defaultControllerObjectName);
$pluginRequest->setControllerActionName($defaultActionName);
return $pluginRequest;
} | php | protected function buildPluginRequest()
{
/** @var $parentRequest ActionRequest */
$parentRequest = $this->runtime->getControllerContext()->getRequest();
$pluginRequest = new ActionRequest($parentRequest);
if (!$this->pluginViewNode instanceof NodeInterface) {
$pluginRequest->setArgumentNamespace('--' . $this->getPluginNamespace());
$this->passArgumentsToPluginRequest($pluginRequest);
$pluginRequest->setControllerPackageKey($this->getPackage());
$pluginRequest->setControllerSubpackageKey($this->getSubpackage());
$pluginRequest->setControllerName($this->getController());
$pluginRequest->setControllerActionName($this->getAction());
return $pluginRequest;
}
$pluginNodeIdentifier = $this->pluginViewNode->getProperty('plugin');
if (strlen($pluginNodeIdentifier) === 0) {
return $pluginRequest;
}
// Set the node to render this to the master plugin node
$this->node = $this->pluginViewNode->getContext()->getNodeByIdentifier($pluginNodeIdentifier);
if ($this->node === null) {
return $pluginRequest;
}
$pluginRequest->setArgument('__node', $this->node);
$pluginRequest->setArgumentNamespace('--' . $this->getPluginNamespace());
$this->passArgumentsToPluginRequest($pluginRequest);
if ($pluginRequest->getControllerObjectName() !== '') {
return $pluginRequest;
}
$controllerObjectPairs = [];
$pluginViewName = $this->pluginViewNode->getProperty('view');
foreach ($this->pluginService->getPluginViewDefinitionsByPluginNodeType($this->node->getNodeType()) as $pluginViewDefinition) {
/** @var PluginViewDefinition $pluginViewDefinition */
if ($pluginViewDefinition->getName() !== $pluginViewName) {
continue;
}
$controllerObjectPairs = $pluginViewDefinition->getControllerActionPairs();
break;
}
if ($controllerObjectPairs === []) {
return $pluginRequest;
}
$defaultControllerObjectName = key($controllerObjectPairs);
$defaultActionName = current($controllerObjectPairs[$defaultControllerObjectName]);
$pluginRequest->setControllerObjectName($defaultControllerObjectName);
$pluginRequest->setControllerActionName($defaultActionName);
return $pluginRequest;
} | [
"protected",
"function",
"buildPluginRequest",
"(",
")",
"{",
"/** @var $parentRequest ActionRequest */",
"$",
"parentRequest",
"=",
"$",
"this",
"->",
"runtime",
"->",
"getControllerContext",
"(",
")",
"->",
"getRequest",
"(",
")",
";",
"$",
"pluginRequest",
"=",
... | Build the proper pluginRequest to render the PluginView
of some configured Master Plugin
@return ActionRequest | [
"Build",
"the",
"proper",
"pluginRequest",
"to",
"render",
"the",
"PluginView",
"of",
"some",
"configured",
"Master",
"Plugin"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/PluginViewImplementation.php#L45-L101 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Service/NodeService.php | NodeService.setDefaultValues | public function setDefaultValues(NodeInterface $node)
{
$nodeType = $node->getNodeType();
foreach ($nodeType->getDefaultValuesForProperties() as $propertyName => $defaultValue) {
$value = $node->getProperty($propertyName);
if ((is_scalar($value) && trim($value) === '') || $value === null) {
$node->setProperty($propertyName, $defaultValue);
}
}
} | php | public function setDefaultValues(NodeInterface $node)
{
$nodeType = $node->getNodeType();
foreach ($nodeType->getDefaultValuesForProperties() as $propertyName => $defaultValue) {
$value = $node->getProperty($propertyName);
if ((is_scalar($value) && trim($value) === '') || $value === null) {
$node->setProperty($propertyName, $defaultValue);
}
}
} | [
"public",
"function",
"setDefaultValues",
"(",
"NodeInterface",
"$",
"node",
")",
"{",
"$",
"nodeType",
"=",
"$",
"node",
"->",
"getNodeType",
"(",
")",
";",
"foreach",
"(",
"$",
"nodeType",
"->",
"getDefaultValuesForProperties",
"(",
")",
"as",
"$",
"proper... | Sets default node property values on the given node.
@param NodeInterface $node
@return void | [
"Sets",
"default",
"node",
"property",
"values",
"on",
"the",
"given",
"node",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeService.php#L55-L64 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Service/NodeService.php | NodeService.createChildNodes | public function createChildNodes(NodeInterface $node)
{
$nodeType = $node->getNodeType();
foreach ($nodeType->getAutoCreatedChildNodes() as $childNodeName => $childNodeType) {
try {
$node->createNode($childNodeName, $childNodeType);
} catch (NodeExistsException $exception) {
// If you have a node that has been marked as removed, but is needed again
// the old node is recovered
$childNodePath = NodePaths::addNodePathSegment($node->getPath(), $childNodeName);
$contextProperties = $node->getContext()->getProperties();
$contextProperties['removedContentShown'] = true;
$context = $this->contextFactory->create($contextProperties);
$childNode = $context->getNode($childNodePath);
if ($childNode->isRemoved()) {
$childNode->setRemoved(false);
}
}
}
} | php | public function createChildNodes(NodeInterface $node)
{
$nodeType = $node->getNodeType();
foreach ($nodeType->getAutoCreatedChildNodes() as $childNodeName => $childNodeType) {
try {
$node->createNode($childNodeName, $childNodeType);
} catch (NodeExistsException $exception) {
// If you have a node that has been marked as removed, but is needed again
// the old node is recovered
$childNodePath = NodePaths::addNodePathSegment($node->getPath(), $childNodeName);
$contextProperties = $node->getContext()->getProperties();
$contextProperties['removedContentShown'] = true;
$context = $this->contextFactory->create($contextProperties);
$childNode = $context->getNode($childNodePath);
if ($childNode->isRemoved()) {
$childNode->setRemoved(false);
}
}
}
} | [
"public",
"function",
"createChildNodes",
"(",
"NodeInterface",
"$",
"node",
")",
"{",
"$",
"nodeType",
"=",
"$",
"node",
"->",
"getNodeType",
"(",
")",
";",
"foreach",
"(",
"$",
"nodeType",
"->",
"getAutoCreatedChildNodes",
"(",
")",
"as",
"$",
"childNodeNa... | Creates missing child nodes for the given node.
@param NodeInterface $node
@return void | [
"Creates",
"missing",
"child",
"nodes",
"for",
"the",
"given",
"node",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeService.php#L72-L91 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Service/NodeService.php | NodeService.cleanUpAutoCreatedChildNodes | public function cleanUpAutoCreatedChildNodes(NodeInterface $node, NodeType $oldNodeType)
{
$newNodeType = $node->getNodeType();
$autoCreatedChildNodesForNewNodeType = $newNodeType->getAutoCreatedChildNodes();
$autoCreatedChildNodesForOldNodeType = $oldNodeType->getAutoCreatedChildNodes();
$removedChildNodesFromOldNodeType = array_diff(
array_keys($autoCreatedChildNodesForOldNodeType),
array_keys($autoCreatedChildNodesForNewNodeType)
);
/** @var NodeInterface $childNode */
foreach ($node->getChildNodes() as $childNode) {
if (in_array($childNode->getName(), $removedChildNodesFromOldNodeType)) {
$childNode->remove();
}
}
} | php | public function cleanUpAutoCreatedChildNodes(NodeInterface $node, NodeType $oldNodeType)
{
$newNodeType = $node->getNodeType();
$autoCreatedChildNodesForNewNodeType = $newNodeType->getAutoCreatedChildNodes();
$autoCreatedChildNodesForOldNodeType = $oldNodeType->getAutoCreatedChildNodes();
$removedChildNodesFromOldNodeType = array_diff(
array_keys($autoCreatedChildNodesForOldNodeType),
array_keys($autoCreatedChildNodesForNewNodeType)
);
/** @var NodeInterface $childNode */
foreach ($node->getChildNodes() as $childNode) {
if (in_array($childNode->getName(), $removedChildNodesFromOldNodeType)) {
$childNode->remove();
}
}
} | [
"public",
"function",
"cleanUpAutoCreatedChildNodes",
"(",
"NodeInterface",
"$",
"node",
",",
"NodeType",
"$",
"oldNodeType",
")",
"{",
"$",
"newNodeType",
"=",
"$",
"node",
"->",
"getNodeType",
"(",
")",
";",
"$",
"autoCreatedChildNodesForNewNodeType",
"=",
"$",
... | Removes all auto created child nodes that existed in the previous nodeType.
@param NodeInterface $node
@param NodeType $oldNodeType
@return void | [
"Removes",
"all",
"auto",
"created",
"child",
"nodes",
"that",
"existed",
"in",
"the",
"previous",
"nodeType",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeService.php#L100-L115 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Service/NodeService.php | NodeService.nodePathAvailableForNode | public function nodePathAvailableForNode($nodePath, NodeInterface $node)
{
/** @var NodeData $existingNodeData */
$existingNodeDataObjects = $this->nodeDataRepository->findByPathWithoutReduce($nodePath, $node->getWorkspace(), true);
foreach ($existingNodeDataObjects as $existingNodeData) {
if ($existingNodeData->getMovedTo() !== null && $existingNodeData->getMovedTo() === $node->getNodeData()) {
return true;
}
}
return !$this->nodePathExistsInAnyContext($nodePath);
} | php | public function nodePathAvailableForNode($nodePath, NodeInterface $node)
{
/** @var NodeData $existingNodeData */
$existingNodeDataObjects = $this->nodeDataRepository->findByPathWithoutReduce($nodePath, $node->getWorkspace(), true);
foreach ($existingNodeDataObjects as $existingNodeData) {
if ($existingNodeData->getMovedTo() !== null && $existingNodeData->getMovedTo() === $node->getNodeData()) {
return true;
}
}
return !$this->nodePathExistsInAnyContext($nodePath);
} | [
"public",
"function",
"nodePathAvailableForNode",
"(",
"$",
"nodePath",
",",
"NodeInterface",
"$",
"node",
")",
"{",
"/** @var NodeData $existingNodeData */",
"$",
"existingNodeDataObjects",
"=",
"$",
"this",
"->",
"nodeDataRepository",
"->",
"findByPathWithoutReduce",
"(... | Checks if the given node path can be used for the given node.
@param string $nodePath
@param NodeInterface $node
@return boolean | [
"Checks",
"if",
"the",
"given",
"node",
"path",
"can",
"be",
"used",
"for",
"the",
"given",
"node",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeService.php#L170-L180 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Service/NodeService.php | NodeService.generateUniqueNodeName | public function generateUniqueNodeName($parentPath, $idealNodeName = null)
{
$possibleNodeName = $this->generatePossibleNodeName($idealNodeName);
while ($this->nodePathExistsInAnyContext(NodePaths::addNodePathSegment($parentPath, $possibleNodeName))) {
$possibleNodeName = $this->generatePossibleNodeName();
}
return $possibleNodeName;
} | php | public function generateUniqueNodeName($parentPath, $idealNodeName = null)
{
$possibleNodeName = $this->generatePossibleNodeName($idealNodeName);
while ($this->nodePathExistsInAnyContext(NodePaths::addNodePathSegment($parentPath, $possibleNodeName))) {
$possibleNodeName = $this->generatePossibleNodeName();
}
return $possibleNodeName;
} | [
"public",
"function",
"generateUniqueNodeName",
"(",
"$",
"parentPath",
",",
"$",
"idealNodeName",
"=",
"null",
")",
"{",
"$",
"possibleNodeName",
"=",
"$",
"this",
"->",
"generatePossibleNodeName",
"(",
"$",
"idealNodeName",
")",
";",
"while",
"(",
"$",
"this... | Generate a node name, optionally based on a suggested "ideal" name
@param string $parentPath
@param string $idealNodeName Can be any string, doesn't need to be a valid node name.
@return string | [
"Generate",
"a",
"node",
"name",
"optionally",
"based",
"on",
"a",
"suggested",
"ideal",
"name"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeService.php#L202-L211 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Service/NodeService.php | NodeService.generatePossibleNodeName | protected function generatePossibleNodeName($idealNodeName = null)
{
if ($idealNodeName !== null) {
$possibleNodeName = Utility::renderValidNodeName($idealNodeName);
} else {
$possibleNodeName = NodePaths::generateRandomNodeName();
}
return $possibleNodeName;
} | php | protected function generatePossibleNodeName($idealNodeName = null)
{
if ($idealNodeName !== null) {
$possibleNodeName = Utility::renderValidNodeName($idealNodeName);
} else {
$possibleNodeName = NodePaths::generateRandomNodeName();
}
return $possibleNodeName;
} | [
"protected",
"function",
"generatePossibleNodeName",
"(",
"$",
"idealNodeName",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"idealNodeName",
"!==",
"null",
")",
"{",
"$",
"possibleNodeName",
"=",
"Utility",
"::",
"renderValidNodeName",
"(",
"$",
"idealNodeName",
")",... | Generate possible node name. When an idealNodeName is given then this is put into a valid format for a node name,
otherwise a random node name in the form "node-alphanumeric" is generated.
@param string $idealNodeName
@return string | [
"Generate",
"possible",
"node",
"name",
".",
"When",
"an",
"idealNodeName",
"is",
"given",
"then",
"this",
"is",
"put",
"into",
"a",
"valid",
"format",
"for",
"a",
"node",
"name",
"otherwise",
"a",
"random",
"node",
"name",
"in",
"the",
"form",
"node",
"... | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeService.php#L220-L229 | train |
neos/neos-development-collection | Neos.Neos/Classes/Service/NodeOperations.php | NodeOperations.create | public function create(NodeInterface $referenceNode, array $nodeData, $position)
{
if (!in_array($position, ['before', 'into', 'after'], true)) {
throw new \InvalidArgumentException('The position should be one of the following: "before", "into", "after".', 1347133640);
}
$nodeType = $this->nodeTypeManager->getNodeType($nodeData['nodeType']);
if ($nodeType->isOfType('Neos.Neos:Document') && !isset($nodeData['properties']['uriPathSegment']) && isset($nodeData['properties']['title'])) {
$nodeData['properties']['uriPathSegment'] = $this->nodeUriPathSegmentGenerator->generateUriPathSegment($referenceNode, $nodeData['properties']['title']);
}
$proposedNodeName = isset($nodeData['nodeName']) ? $nodeData['nodeName'] : null;
$nodeData['nodeName'] = $this->nodeService->generateUniqueNodeName($this->getDesignatedParentNode($referenceNode, $position)->getPath(), $proposedNodeName);
if ($position === 'into') {
$newNode = $referenceNode->createNode($nodeData['nodeName'], $nodeType);
} else {
$parentNode = $referenceNode->getParent();
$newNode = $parentNode->createNode($nodeData['nodeName'], $nodeType);
if ($position === 'before') {
$newNode->moveBefore($referenceNode);
} else {
$newNode->moveAfter($referenceNode);
}
}
if (isset($nodeData['properties']) && is_array($nodeData['properties'])) {
foreach ($nodeData['properties'] as $propertyName => $propertyValue) {
$newNode->setProperty($propertyName, $propertyValue);
}
}
return $newNode;
} | php | public function create(NodeInterface $referenceNode, array $nodeData, $position)
{
if (!in_array($position, ['before', 'into', 'after'], true)) {
throw new \InvalidArgumentException('The position should be one of the following: "before", "into", "after".', 1347133640);
}
$nodeType = $this->nodeTypeManager->getNodeType($nodeData['nodeType']);
if ($nodeType->isOfType('Neos.Neos:Document') && !isset($nodeData['properties']['uriPathSegment']) && isset($nodeData['properties']['title'])) {
$nodeData['properties']['uriPathSegment'] = $this->nodeUriPathSegmentGenerator->generateUriPathSegment($referenceNode, $nodeData['properties']['title']);
}
$proposedNodeName = isset($nodeData['nodeName']) ? $nodeData['nodeName'] : null;
$nodeData['nodeName'] = $this->nodeService->generateUniqueNodeName($this->getDesignatedParentNode($referenceNode, $position)->getPath(), $proposedNodeName);
if ($position === 'into') {
$newNode = $referenceNode->createNode($nodeData['nodeName'], $nodeType);
} else {
$parentNode = $referenceNode->getParent();
$newNode = $parentNode->createNode($nodeData['nodeName'], $nodeType);
if ($position === 'before') {
$newNode->moveBefore($referenceNode);
} else {
$newNode->moveAfter($referenceNode);
}
}
if (isset($nodeData['properties']) && is_array($nodeData['properties'])) {
foreach ($nodeData['properties'] as $propertyName => $propertyValue) {
$newNode->setProperty($propertyName, $propertyValue);
}
}
return $newNode;
} | [
"public",
"function",
"create",
"(",
"NodeInterface",
"$",
"referenceNode",
",",
"array",
"$",
"nodeData",
",",
"$",
"position",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"position",
",",
"[",
"'before'",
",",
"'into'",
",",
"'after'",
"]",
",",
... | Helper method for creating a new node.
@param NodeInterface $referenceNode
@param array $nodeData
@param string $position
@return NodeInterface
@throws \InvalidArgumentException | [
"Helper",
"method",
"for",
"creating",
"a",
"new",
"node",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/NodeOperations.php#L56-L90 | train |
neos/neos-development-collection | Neos.Neos/Classes/Routing/NodeIdentityConverterAspect.php | NodeIdentityConverterAspect.convertNodeToContextPathForRouting | public function convertNodeToContextPathForRouting(JoinPointInterface $joinPoint)
{
$objectArgument = $joinPoint->getMethodArgument('object');
if ($objectArgument instanceof NodeInterface) {
return $objectArgument->getContextPath();
} else {
return $joinPoint->getAdviceChain()->proceed($joinPoint);
}
} | php | public function convertNodeToContextPathForRouting(JoinPointInterface $joinPoint)
{
$objectArgument = $joinPoint->getMethodArgument('object');
if ($objectArgument instanceof NodeInterface) {
return $objectArgument->getContextPath();
} else {
return $joinPoint->getAdviceChain()->proceed($joinPoint);
}
} | [
"public",
"function",
"convertNodeToContextPathForRouting",
"(",
"JoinPointInterface",
"$",
"joinPoint",
")",
"{",
"$",
"objectArgument",
"=",
"$",
"joinPoint",
"->",
"getMethodArgument",
"(",
"'object'",
")",
";",
"if",
"(",
"$",
"objectArgument",
"instanceof",
"No... | Convert the object to its context path, if we deal with ContentRepository nodes.
@Flow\Around("method(Neos\Flow\Persistence\AbstractPersistenceManager->convertObjectToIdentityArray())")
@param JoinPointInterface $joinPoint the joinpoint
@return string|array the context path to be used for routing | [
"Convert",
"the",
"object",
"to",
"its",
"context",
"path",
"if",
"we",
"deal",
"with",
"ContentRepository",
"nodes",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/NodeIdentityConverterAspect.php#L37-L45 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Utility.php | Utility.buildAutoCreatedChildNodeIdentifier | public static function buildAutoCreatedChildNodeIdentifier($childNodeName, $identifier)
{
$hex = md5($identifier . '-' . $childNodeName);
return substr($hex, 0, 8) . '-' . substr($hex, 8, 4) . '-' . substr($hex, 12, 4) . '-' . substr($hex, 16, 4) . '-' . substr($hex, 20, 12);
} | php | public static function buildAutoCreatedChildNodeIdentifier($childNodeName, $identifier)
{
$hex = md5($identifier . '-' . $childNodeName);
return substr($hex, 0, 8) . '-' . substr($hex, 8, 4) . '-' . substr($hex, 12, 4) . '-' . substr($hex, 16, 4) . '-' . substr($hex, 20, 12);
} | [
"public",
"static",
"function",
"buildAutoCreatedChildNodeIdentifier",
"(",
"$",
"childNodeName",
",",
"$",
"identifier",
")",
"{",
"$",
"hex",
"=",
"md5",
"(",
"$",
"identifier",
".",
"'-'",
".",
"$",
"childNodeName",
")",
";",
"return",
"substr",
"(",
"$",... | Generate a stable identifier for auto-created child nodes
This is needed if multiple node variants are created through "createNode" with different dimension values. If
child nodes with the same path and different identifiers exist, bad things can happen.
@param string $childNodeName
@param string $identifier Identifier of the node where the child node should be created
@return string The generated UUID like identifier | [
"Generate",
"a",
"stable",
"identifier",
"for",
"auto",
"-",
"created",
"child",
"nodes"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Utility.php#L86-L91 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Factory/NodeFactory.php | NodeFactory.createFromNodeData | public function createFromNodeData(NodeData $nodeData, Context $context)
{
if ($nodeData->isInternal()) {
return null;
}
$internalNodeIdentifier = $nodeData->getIdentifier() . spl_object_hash($context);
// In case there is a Node with an internal NodeData (because the NodeData was changed in the meantime) we need to flush it.
if (isset($this->nodes[$internalNodeIdentifier]) && $this->nodes[$internalNodeIdentifier]->getNodeData()->isInternal()) {
unset($this->nodes[$internalNodeIdentifier]);
}
if (!isset($this->nodes[$internalNodeIdentifier])) {
// Warning: Alternative node implementations are considered internal for now, feature can change or be removed anytime. We want to be sure it works well and makes sense before declaring it public.
$class = $nodeData->getNodeType()->getConfiguration('class') ?: $this->objectManager->getClassNameByObjectName(NodeInterface::class);
if (!in_array($class, static::getNodeInterfaceImplementations($this->objectManager))) {
throw new NodeConfigurationException('The configured implementation class name "' . $class . '" for NodeType "' . $nodeData->getNodeType() . '" does not inherit from ' .NodeInterface::class.'.', 1406884014);
}
$this->nodes[$internalNodeIdentifier] = new $class($nodeData, $context);
}
$node = $this->nodes[$internalNodeIdentifier];
return $this->filterNodeByContext($node, $context);
} | php | public function createFromNodeData(NodeData $nodeData, Context $context)
{
if ($nodeData->isInternal()) {
return null;
}
$internalNodeIdentifier = $nodeData->getIdentifier() . spl_object_hash($context);
// In case there is a Node with an internal NodeData (because the NodeData was changed in the meantime) we need to flush it.
if (isset($this->nodes[$internalNodeIdentifier]) && $this->nodes[$internalNodeIdentifier]->getNodeData()->isInternal()) {
unset($this->nodes[$internalNodeIdentifier]);
}
if (!isset($this->nodes[$internalNodeIdentifier])) {
// Warning: Alternative node implementations are considered internal for now, feature can change or be removed anytime. We want to be sure it works well and makes sense before declaring it public.
$class = $nodeData->getNodeType()->getConfiguration('class') ?: $this->objectManager->getClassNameByObjectName(NodeInterface::class);
if (!in_array($class, static::getNodeInterfaceImplementations($this->objectManager))) {
throw new NodeConfigurationException('The configured implementation class name "' . $class . '" for NodeType "' . $nodeData->getNodeType() . '" does not inherit from ' .NodeInterface::class.'.', 1406884014);
}
$this->nodes[$internalNodeIdentifier] = new $class($nodeData, $context);
}
$node = $this->nodes[$internalNodeIdentifier];
return $this->filterNodeByContext($node, $context);
} | [
"public",
"function",
"createFromNodeData",
"(",
"NodeData",
"$",
"nodeData",
",",
"Context",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"nodeData",
"->",
"isInternal",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"internalNodeIdentifier",
"=",
"$",... | Creates a node from the given NodeData container.
If this factory has previously created a Node for the given $node and it's dimensions,
it will return the same node again.
@param NodeData $nodeData
@param Context $context
@return NodeInterface
@throws NodeConfigurationException if a configured 'class' for a Node does not exist or does not inherit NodeInterface | [
"Creates",
"a",
"node",
"from",
"the",
"given",
"NodeData",
"container",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Factory/NodeFactory.php#L68-L92 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Factory/NodeFactory.php | NodeFactory.getNodeInterfaceImplementations | public static function getNodeInterfaceImplementations($objectManager)
{
$reflectionService = $objectManager->get(ReflectionService::class);
$nodeImplementations = $reflectionService->getAllImplementationClassNamesForInterface(NodeInterface::class);
return $nodeImplementations;
} | php | public static function getNodeInterfaceImplementations($objectManager)
{
$reflectionService = $objectManager->get(ReflectionService::class);
$nodeImplementations = $reflectionService->getAllImplementationClassNamesForInterface(NodeInterface::class);
return $nodeImplementations;
} | [
"public",
"static",
"function",
"getNodeInterfaceImplementations",
"(",
"$",
"objectManager",
")",
"{",
"$",
"reflectionService",
"=",
"$",
"objectManager",
"->",
"get",
"(",
"ReflectionService",
"::",
"class",
")",
";",
"$",
"nodeImplementations",
"=",
"$",
"refl... | Get all NodeInterface implementations to check if a configured node class is in there.
@param ObjectManagerInterface $objectManager
@return array
@Flow\CompileStatic | [
"Get",
"all",
"NodeInterface",
"implementations",
"to",
"check",
"if",
"a",
"configured",
"node",
"class",
"is",
"in",
"there",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Factory/NodeFactory.php#L101-L106 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Factory/NodeFactory.php | NodeFactory.filterNodeByContext | protected function filterNodeByContext(NodeInterface $node, Context $context)
{
$this->securityContext->withoutAuthorizationChecks(function () use (&$node, $context) {
if (!$context->isRemovedContentShown() && $node->isRemoved()) {
$node = null;
return;
}
if (!$context->isInvisibleContentShown() && !$node->isVisible()) {
$node = null;
return;
}
if (!$context->isInaccessibleContentShown() && !$node->isAccessible()) {
$node = null;
}
});
return $node;
} | php | protected function filterNodeByContext(NodeInterface $node, Context $context)
{
$this->securityContext->withoutAuthorizationChecks(function () use (&$node, $context) {
if (!$context->isRemovedContentShown() && $node->isRemoved()) {
$node = null;
return;
}
if (!$context->isInvisibleContentShown() && !$node->isVisible()) {
$node = null;
return;
}
if (!$context->isInaccessibleContentShown() && !$node->isAccessible()) {
$node = null;
}
});
return $node;
} | [
"protected",
"function",
"filterNodeByContext",
"(",
"NodeInterface",
"$",
"node",
",",
"Context",
"$",
"context",
")",
"{",
"$",
"this",
"->",
"securityContext",
"->",
"withoutAuthorizationChecks",
"(",
"function",
"(",
")",
"use",
"(",
"&",
"$",
"node",
",",... | Filter a node by the current context.
Will either return the node or NULL if it is not permitted in current context.
@param NodeInterface $node
@param Context $context
@return NodeInterface|NULL | [
"Filter",
"a",
"node",
"by",
"the",
"current",
"context",
".",
"Will",
"either",
"return",
"the",
"node",
"or",
"NULL",
"if",
"it",
"is",
"not",
"permitted",
"in",
"current",
"context",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Factory/NodeFactory.php#L116-L132 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Domain/Factory/NodeFactory.php | NodeFactory.createContextMatchingNodeData | public function createContextMatchingNodeData(NodeData $nodeData)
{
return $this->contextFactory->create([
'workspaceName' => $nodeData->getWorkspace()->getName(),
'invisibleContentShown' => true,
'inaccessibleContentShown' => true,
'removedContentShown' => true,
'dimensions' => $nodeData->getDimensionValues()
]);
} | php | public function createContextMatchingNodeData(NodeData $nodeData)
{
return $this->contextFactory->create([
'workspaceName' => $nodeData->getWorkspace()->getName(),
'invisibleContentShown' => true,
'inaccessibleContentShown' => true,
'removedContentShown' => true,
'dimensions' => $nodeData->getDimensionValues()
]);
} | [
"public",
"function",
"createContextMatchingNodeData",
"(",
"NodeData",
"$",
"nodeData",
")",
"{",
"return",
"$",
"this",
"->",
"contextFactory",
"->",
"create",
"(",
"[",
"'workspaceName'",
"=>",
"$",
"nodeData",
"->",
"getWorkspace",
"(",
")",
"->",
"getName",... | Generates a Context that exactly fits the given NodeData Workspace and Dimensions.
TODO: We could get more specific about removed and invisible content by adding some more logic here that generates fitting values.
@param NodeData $nodeData
@return Context | [
"Generates",
"a",
"Context",
"that",
"exactly",
"fits",
"the",
"given",
"NodeData",
"Workspace",
"and",
"Dimensions",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Factory/NodeFactory.php#L142-L151 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Command/NodeCommandController.php | NodeCommandController.repairCommand | public function repairCommand($nodeType = null, $workspace = 'live', $dryRun = false, $cleanup = true, $skip = null, $only = null)
{
$this->pluginConfigurations = self::detectPlugins($this->objectManager);
/** @noinspection PhpUndefinedMethodInspection */
if ($this->workspaceRepository->countByName($workspace) === 0) {
$this->outputLine('Workspace "%s" does not exist', [$workspace]);
exit(1);
}
if ($nodeType !== null) {
try {
$nodeType = $this->nodeTypeManager->getNodeType($nodeType);
} catch (NodeTypeNotFoundException $e) {
$this->outputLine('<error>Node type "%s" does not exist</error>', [$nodeType]);
$this->quit(1);
return;
}
}
if ($dryRun) {
$this->outputLine('Dry run, not committing any changes.');
}
if (!$cleanup) {
$this->outputLine('Omitting cleanup tasks.');
}
foreach ($this->pluginConfigurations as $pluginConfiguration) {
/** @var NodeCommandControllerPluginInterface $plugin */
$plugin = $pluginConfiguration['object'];
$this->outputLine('<b>' . $plugin->getSubCommandShortDescription('repair') . '</b>');
$this->outputLine();
if ($plugin instanceof EventDispatchingNodeCommandControllerPluginInterface) {
$this->attachPluginEventHandlers($plugin, $dryRun);
}
/** @noinspection PhpMethodParametersCountMismatchInspection */
$plugin->invokeSubCommand('repair', $this->output, $nodeType, $workspace, $dryRun, $cleanup, $skip, $only);
$this->outputLine();
}
if ($dryRun) {
$this->outputLine('Node repair dry run finished.');
} else {
$this->outputLine('<success>Node repair finished.</success>');
}
} | php | public function repairCommand($nodeType = null, $workspace = 'live', $dryRun = false, $cleanup = true, $skip = null, $only = null)
{
$this->pluginConfigurations = self::detectPlugins($this->objectManager);
/** @noinspection PhpUndefinedMethodInspection */
if ($this->workspaceRepository->countByName($workspace) === 0) {
$this->outputLine('Workspace "%s" does not exist', [$workspace]);
exit(1);
}
if ($nodeType !== null) {
try {
$nodeType = $this->nodeTypeManager->getNodeType($nodeType);
} catch (NodeTypeNotFoundException $e) {
$this->outputLine('<error>Node type "%s" does not exist</error>', [$nodeType]);
$this->quit(1);
return;
}
}
if ($dryRun) {
$this->outputLine('Dry run, not committing any changes.');
}
if (!$cleanup) {
$this->outputLine('Omitting cleanup tasks.');
}
foreach ($this->pluginConfigurations as $pluginConfiguration) {
/** @var NodeCommandControllerPluginInterface $plugin */
$plugin = $pluginConfiguration['object'];
$this->outputLine('<b>' . $plugin->getSubCommandShortDescription('repair') . '</b>');
$this->outputLine();
if ($plugin instanceof EventDispatchingNodeCommandControllerPluginInterface) {
$this->attachPluginEventHandlers($plugin, $dryRun);
}
/** @noinspection PhpMethodParametersCountMismatchInspection */
$plugin->invokeSubCommand('repair', $this->output, $nodeType, $workspace, $dryRun, $cleanup, $skip, $only);
$this->outputLine();
}
if ($dryRun) {
$this->outputLine('Node repair dry run finished.');
} else {
$this->outputLine('<success>Node repair finished.</success>');
}
} | [
"public",
"function",
"repairCommand",
"(",
"$",
"nodeType",
"=",
"null",
",",
"$",
"workspace",
"=",
"'live'",
",",
"$",
"dryRun",
"=",
"false",
",",
"$",
"cleanup",
"=",
"true",
",",
"$",
"skip",
"=",
"null",
",",
"$",
"only",
"=",
"null",
")",
"... | Repair inconsistent nodes
This command analyzes and repairs the node tree structure and individual nodes
based on the current node type configuration.
It is possible to execute only one or more specific checks by providing the <b>--skip</b>
or <b>--only</b> option. See the full description of checks further below for possible check
identifiers.
The following checks will be performed:
{pluginDescriptions}
<b>Examples:</b>
./flow node:repair
./flow node:repair --node-type Neos.NodeTypes:Page
./flow node:repair --workspace user-robert --only removeOrphanNodes,removeNodesWithInvalidDimensions
./flow node:repair --skip removeUndefinedProperties
@param string $nodeType Node type name, if empty update all declared node types
@param string $workspace Workspace name, default is 'live'
@param boolean $dryRun Don't do anything, but report actions
@param boolean $cleanup If false, cleanup tasks are skipped
@param string $skip Skip the given check or checks (comma separated)
@param string $only Only execute the given check or checks (comma separated)
@return void
@throws StopActionException | [
"Repair",
"inconsistent",
"nodes"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandController.php#L86-L132 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Command/NodeCommandController.php | NodeCommandController.processDescription | public static function processDescription($controllerCommandName, $description, ObjectManagerInterface $objectManager)
{
$pluginConfigurations = self::detectPlugins($objectManager);
$pluginDescriptions = '';
foreach ($pluginConfigurations as $className => $configuration) {
/** @noinspection PhpUndefinedMethodInspection */
$pluginDescriptions .= $className::getSubCommandDescription($controllerCommandName) . PHP_EOL;
}
return str_replace('{pluginDescriptions}', $pluginDescriptions, $description);
} | php | public static function processDescription($controllerCommandName, $description, ObjectManagerInterface $objectManager)
{
$pluginConfigurations = self::detectPlugins($objectManager);
$pluginDescriptions = '';
foreach ($pluginConfigurations as $className => $configuration) {
/** @noinspection PhpUndefinedMethodInspection */
$pluginDescriptions .= $className::getSubCommandDescription($controllerCommandName) . PHP_EOL;
}
return str_replace('{pluginDescriptions}', $pluginDescriptions, $description);
} | [
"public",
"static",
"function",
"processDescription",
"(",
"$",
"controllerCommandName",
",",
"$",
"description",
",",
"ObjectManagerInterface",
"$",
"objectManager",
")",
"{",
"$",
"pluginConfigurations",
"=",
"self",
"::",
"detectPlugins",
"(",
"$",
"objectManager",... | Processes the given description of the specified command.
@param string $controllerCommandName Name of the command the description is referring to, for example "flush"
@param string $description The command description so far
@param ObjectManagerInterface $objectManager The object manager, can be used to access further information necessary for rendering the description
@return string the possibly modified command description | [
"Processes",
"the",
"given",
"description",
"of",
"the",
"specified",
"command",
"."
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandController.php#L193-L202 | train |
neos/neos-development-collection | Neos.ContentRepository/Classes/Command/NodeCommandController.php | NodeCommandController.detectPlugins | protected static function detectPlugins(ObjectManagerInterface $objectManager)
{
$pluginConfigurations = [];
$classNames = $objectManager->get(ReflectionService::class)->getAllImplementationClassNamesForInterface(NodeCommandControllerPluginInterface::class);
foreach ($classNames as $className) {
$pluginConfigurations[$className] = [
'object' => $objectManager->get($objectManager->getObjectNameByClassName($className))
];
}
return $pluginConfigurations;
} | php | protected static function detectPlugins(ObjectManagerInterface $objectManager)
{
$pluginConfigurations = [];
$classNames = $objectManager->get(ReflectionService::class)->getAllImplementationClassNamesForInterface(NodeCommandControllerPluginInterface::class);
foreach ($classNames as $className) {
$pluginConfigurations[$className] = [
'object' => $objectManager->get($objectManager->getObjectNameByClassName($className))
];
}
return $pluginConfigurations;
} | [
"protected",
"static",
"function",
"detectPlugins",
"(",
"ObjectManagerInterface",
"$",
"objectManager",
")",
"{",
"$",
"pluginConfigurations",
"=",
"[",
"]",
";",
"$",
"classNames",
"=",
"$",
"objectManager",
"->",
"get",
"(",
"ReflectionService",
"::",
"class",
... | Detects plugins for this command controller
@param ObjectManagerInterface $objectManager
@return array | [
"Detects",
"plugins",
"for",
"this",
"command",
"controller"
] | 9062fb5e8e9217bc99324b7eba0378e9274fc051 | https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandController.php#L210-L220 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.