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/ViewHelpers/ContentElement/EditableViewHelper.php
EditableViewHelper.render
public function render($property, $tag = 'div', NodeInterface $node = null) { $this->tag->setTagName($tag); $this->tag->forceClosingTag(true); $content = $this->renderChildren(); if ($node === null) { $node = $this->getNodeFromFusionContext(); } if ($node === null) { throw new ViewHelperException('A node is required, but one was not supplied and could not be found in the Fusion context.', 1408521638); } if ($content === null) { if (!$this->templateVariableContainer->exists($property)) { throw new ViewHelperException(sprintf('The property "%1$s" was not set as a template variable. If you use this ViewHelper in a partial, make sure to pass the node property "%1$s" as an argument.', $property), 1384507046); } $content = $this->templateVariableContainer->get($property); } $this->tag->setContent($content); return $this->contentElementEditableService->wrapContentProperty($node, $property, $this->tag->render()); }
php
public function render($property, $tag = 'div', NodeInterface $node = null) { $this->tag->setTagName($tag); $this->tag->forceClosingTag(true); $content = $this->renderChildren(); if ($node === null) { $node = $this->getNodeFromFusionContext(); } if ($node === null) { throw new ViewHelperException('A node is required, but one was not supplied and could not be found in the Fusion context.', 1408521638); } if ($content === null) { if (!$this->templateVariableContainer->exists($property)) { throw new ViewHelperException(sprintf('The property "%1$s" was not set as a template variable. If you use this ViewHelper in a partial, make sure to pass the node property "%1$s" as an argument.', $property), 1384507046); } $content = $this->templateVariableContainer->get($property); } $this->tag->setContent($content); return $this->contentElementEditableService->wrapContentProperty($node, $property, $this->tag->render()); }
[ "public", "function", "render", "(", "$", "property", ",", "$", "tag", "=", "'div'", ",", "NodeInterface", "$", "node", "=", "null", ")", "{", "$", "this", "->", "tag", "->", "setTagName", "(", "$", "tag", ")", ";", "$", "this", "->", "tag", "->", ...
In live workspace this just renders a tag; for logged in users with access to the Backend this also adds required attributes for the editing. @param string $property Name of the property to render. Note: If this tag has child nodes, they overrule this argument! @param string $tag The name of the tag that should be wrapped around the property. By default this is a <div> @param NodeInterface $node The node of the content element. Optional, will be resolved from the Fusion context by default. @return string The rendered property with a wrapping tag. In the user workspace this adds some required attributes for the RTE to work @throws ViewHelperException
[ "In", "live", "workspace", "this", "just", "renders", "a", "tag", ";", "for", "logged", "in", "users", "with", "access", "to", "the", "Backend", "this", "also", "adds", "required", "attributes", "for", "the", "editing", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php#L76-L99
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/UsersController.php
UsersController.newAction
public function newAction(User $user = null) { $this->view->assignMultiple([ 'currentUser' => $this->currentUser, 'user' => $user, 'roles' => $this->policyService->getRoles(), 'providers' => $this->getAuthenticationProviders() ]); }
php
public function newAction(User $user = null) { $this->view->assignMultiple([ 'currentUser' => $this->currentUser, 'user' => $user, 'roles' => $this->policyService->getRoles(), 'providers' => $this->getAuthenticationProviders() ]); }
[ "public", "function", "newAction", "(", "User", "$", "user", "=", "null", ")", "{", "$", "this", "->", "view", "->", "assignMultiple", "(", "[", "'currentUser'", "=>", "$", "this", "->", "currentUser", ",", "'user'", "=>", "$", "user", ",", "'roles'", ...
Renders a form for creating a new user @param User $user @return void
[ "Renders", "a", "form", "for", "creating", "a", "new", "user" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/UsersController.php#L117-L125
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/UsersController.php
UsersController.editAction
public function editAction(User $user) { $this->assignElectronicAddressOptions(); $this->view->assignMultiple([ 'currentUser' => $this->currentUser, 'user' => $user, 'availableRoles' => $this->policyService->getRoles() ]); }
php
public function editAction(User $user) { $this->assignElectronicAddressOptions(); $this->view->assignMultiple([ 'currentUser' => $this->currentUser, 'user' => $user, 'availableRoles' => $this->policyService->getRoles() ]); }
[ "public", "function", "editAction", "(", "User", "$", "user", ")", "{", "$", "this", "->", "assignElectronicAddressOptions", "(", ")", ";", "$", "this", "->", "view", "->", "assignMultiple", "(", "[", "'currentUser'", "=>", "$", "this", "->", "currentUser", ...
Edit an existing user @param User $user @return void
[ "Edit", "an", "existing", "user" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/UsersController.php#L153-L162
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/UsersController.php
UsersController.deleteAction
public function deleteAction(User $user) { if ($user === $this->currentUser) { $this->addFlashMessage('You can not delete the currently logged in user', 'Current user can\'t be deleted', Message::SEVERITY_WARNING, [], 1412374546); $this->redirect('index'); } $this->userService->deleteUser($user); $this->addFlashMessage('The user "%s" has been deleted.', 'User deleted', Message::SEVERITY_NOTICE, [htmlspecialchars($user->getName()->getFullName())], 1412374546); $this->redirect('index'); }
php
public function deleteAction(User $user) { if ($user === $this->currentUser) { $this->addFlashMessage('You can not delete the currently logged in user', 'Current user can\'t be deleted', Message::SEVERITY_WARNING, [], 1412374546); $this->redirect('index'); } $this->userService->deleteUser($user); $this->addFlashMessage('The user "%s" has been deleted.', 'User deleted', Message::SEVERITY_NOTICE, [htmlspecialchars($user->getName()->getFullName())], 1412374546); $this->redirect('index'); }
[ "public", "function", "deleteAction", "(", "User", "$", "user", ")", "{", "if", "(", "$", "user", "===", "$", "this", "->", "currentUser", ")", "{", "$", "this", "->", "addFlashMessage", "(", "'You can not delete the currently logged in user'", ",", "'Current us...
Delete the given user @param User $user @return void
[ "Delete", "the", "given", "user" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/UsersController.php#L183-L192
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/UsersController.php
UsersController.updateAccountAction
public function updateAccountAction(Account $account, array $roleIdentifiers, array $password = []) { $user = $this->userService->getUser($account->getAccountIdentifier(), $account->getAuthenticationProviderName()); if ($user === $this->currentUser) { $roles = []; foreach ($roleIdentifiers as $roleIdentifier) { $roles[$roleIdentifier] = $this->policyService->getRole($roleIdentifier); } if (!$this->privilegeManager->isPrivilegeTargetGrantedForRoles($roles, 'Neos.Neos:Backend.Module.Administration.Users')) { $this->addFlashMessage('With the selected roles the currently logged in user wouldn\'t have access to this module any longer. Please adjust the assigned roles!', 'Don\'t lock yourself out', Message::SEVERITY_WARNING, [], 1416501197); $this->forward('edit', null, null, ['user' => $this->currentUser]); } } $password = array_shift($password); if (strlen(trim(strval($password))) > 0) { $this->userService->setUserPassword($user, $password); } $this->userService->setRolesForAccount($account, $roleIdentifiers); $this->addFlashMessage('The account has been updated.', 'Account updated', Message::SEVERITY_OK); $this->redirect('edit', null, null, ['user' => $user]); }
php
public function updateAccountAction(Account $account, array $roleIdentifiers, array $password = []) { $user = $this->userService->getUser($account->getAccountIdentifier(), $account->getAuthenticationProviderName()); if ($user === $this->currentUser) { $roles = []; foreach ($roleIdentifiers as $roleIdentifier) { $roles[$roleIdentifier] = $this->policyService->getRole($roleIdentifier); } if (!$this->privilegeManager->isPrivilegeTargetGrantedForRoles($roles, 'Neos.Neos:Backend.Module.Administration.Users')) { $this->addFlashMessage('With the selected roles the currently logged in user wouldn\'t have access to this module any longer. Please adjust the assigned roles!', 'Don\'t lock yourself out', Message::SEVERITY_WARNING, [], 1416501197); $this->forward('edit', null, null, ['user' => $this->currentUser]); } } $password = array_shift($password); if (strlen(trim(strval($password))) > 0) { $this->userService->setUserPassword($user, $password); } $this->userService->setRolesForAccount($account, $roleIdentifiers); $this->addFlashMessage('The account has been updated.', 'Account updated', Message::SEVERITY_OK); $this->redirect('edit', null, null, ['user' => $user]); }
[ "public", "function", "updateAccountAction", "(", "Account", "$", "account", ",", "array", "$", "roleIdentifiers", ",", "array", "$", "password", "=", "[", "]", ")", "{", "$", "user", "=", "$", "this", "->", "userService", "->", "getUser", "(", "$", "acc...
Update a given account @param Account $account The account to update @param array $roleIdentifiers A possibly updated list of roles for the user's primary account @param array $password Expects an array in the format array('<password>', '<password confirmation>') @Flow\Validate(argumentName="password", type="\Neos\Neos\Validation\Validator\PasswordValidator", options={ "allowEmpty"=1, "minimum"=1, "maximum"=255 }) @return void
[ "Update", "a", "given", "account" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/UsersController.php#L218-L239
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/UsersController.php
UsersController.createElectronicAddressAction
public function createElectronicAddressAction(User $user, ElectronicAddress $electronicAddress) { /** @var User $user */ $user->addElectronicAddress($electronicAddress); $this->userService->updateUser($user); $this->addFlashMessage('An electronic address "%s" (%s) has been added.', 'Electronic address added', Message::SEVERITY_OK, [htmlspecialchars($electronicAddress->getIdentifier()), htmlspecialchars($electronicAddress->getType())], 1412374814); $this->redirect('edit', null, null, ['user' => $user]); }
php
public function createElectronicAddressAction(User $user, ElectronicAddress $electronicAddress) { /** @var User $user */ $user->addElectronicAddress($electronicAddress); $this->userService->updateUser($user); $this->addFlashMessage('An electronic address "%s" (%s) has been added.', 'Electronic address added', Message::SEVERITY_OK, [htmlspecialchars($electronicAddress->getIdentifier()), htmlspecialchars($electronicAddress->getType())], 1412374814); $this->redirect('edit', null, null, ['user' => $user]); }
[ "public", "function", "createElectronicAddressAction", "(", "User", "$", "user", ",", "ElectronicAddress", "$", "electronicAddress", ")", "{", "/** @var User $user */", "$", "user", "->", "addElectronicAddress", "(", "$", "electronicAddress", ")", ";", "$", "this", ...
Create an new electronic address @param User $user @param ElectronicAddress $electronicAddress @return void
[ "Create", "an", "new", "electronic", "address" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/UsersController.php#L261-L269
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/UsersController.php
UsersController.deleteElectronicAddressAction
public function deleteElectronicAddressAction(User $user, ElectronicAddress $electronicAddress) { $user->removeElectronicAddress($electronicAddress); $this->userService->updateUser($user); $this->addFlashMessage('The electronic address "%s" (%s) has been deleted for "%s".', 'Electronic address removed', Message::SEVERITY_NOTICE, [htmlspecialchars($electronicAddress->getIdentifier()), htmlspecialchars($electronicAddress->getType()), htmlspecialchars($user->getName())], 1412374678); $this->redirect('edit', null, null, ['user' => $user]); }
php
public function deleteElectronicAddressAction(User $user, ElectronicAddress $electronicAddress) { $user->removeElectronicAddress($electronicAddress); $this->userService->updateUser($user); $this->addFlashMessage('The electronic address "%s" (%s) has been deleted for "%s".', 'Electronic address removed', Message::SEVERITY_NOTICE, [htmlspecialchars($electronicAddress->getIdentifier()), htmlspecialchars($electronicAddress->getType()), htmlspecialchars($user->getName())], 1412374678); $this->redirect('edit', null, null, ['user' => $user]); }
[ "public", "function", "deleteElectronicAddressAction", "(", "User", "$", "user", ",", "ElectronicAddress", "$", "electronicAddress", ")", "{", "$", "user", "->", "removeElectronicAddress", "(", "$", "electronicAddress", ")", ";", "$", "this", "->", "userService", ...
Delete an electronic address action @param User $user @param ElectronicAddress $electronicAddress @return void
[ "Delete", "an", "electronic", "address", "action" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/UsersController.php#L278-L285
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Administration/UsersController.php
UsersController.getAuthenticationProviders
protected function getAuthenticationProviders() { $providerNames = array_keys($this->authenticationManager->getProviders()); sort($providerNames); return array_combine($providerNames, $providerNames); }
php
protected function getAuthenticationProviders() { $providerNames = array_keys($this->authenticationManager->getProviders()); sort($providerNames); return array_combine($providerNames, $providerNames); }
[ "protected", "function", "getAuthenticationProviders", "(", ")", "{", "$", "providerNames", "=", "array_keys", "(", "$", "this", "->", "authenticationManager", "->", "getProviders", "(", ")", ")", ";", "sort", "(", "$", "providerNames", ")", ";", "return", "ar...
Returns sorted list of auth providers by name. @return array
[ "Returns", "sorted", "list", "of", "auth", "providers", "by", "name", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Administration/UsersController.php#L314-L319
train
neos/neos-development-collection
Neos.ContentRepository/Migrations/Postgresql/Version20131203110242.php
Version20131203110242.preDown
public function preDown(Schema $schema) { $result = $this->connection->executeQuery("SELECT installed_version FROM pg_available_extensions WHERE name = 'uuid-ossp'"); if ($result->fetchColumn() === null) { $this->connection->executeUpdate("ALTER TABLE typo3_typo3cr_domain_model_workspace ADD persistence_object_identifier VARCHAR(40)"); $result = $this->connection->executeQuery('SELECT name FROM typo3_typo3cr_domain_model_workspace'); foreach ($result->fetchAll() as $workspace) { $this->connection->update('typo3_typo3cr_domain_model_workspace', array('persistence_object_identifier' => \Neos\Flow\Utility\Algorithms::generateUUID()), array('name' => $workspace['name'])); } } }
php
public function preDown(Schema $schema) { $result = $this->connection->executeQuery("SELECT installed_version FROM pg_available_extensions WHERE name = 'uuid-ossp'"); if ($result->fetchColumn() === null) { $this->connection->executeUpdate("ALTER TABLE typo3_typo3cr_domain_model_workspace ADD persistence_object_identifier VARCHAR(40)"); $result = $this->connection->executeQuery('SELECT name FROM typo3_typo3cr_domain_model_workspace'); foreach ($result->fetchAll() as $workspace) { $this->connection->update('typo3_typo3cr_domain_model_workspace', array('persistence_object_identifier' => \Neos\Flow\Utility\Algorithms::generateUUID()), array('name' => $workspace['name'])); } } }
[ "public", "function", "preDown", "(", "Schema", "$", "schema", ")", "{", "$", "result", "=", "$", "this", "->", "connection", "->", "executeQuery", "(", "\"SELECT installed_version FROM pg_available_extensions WHERE name = 'uuid-ossp'\"", ")", ";", "if", "(", "$", "...
Generate UUIDs in PHP if the uuid-ossp extension is not installed. @param Schema $schema @return void
[ "Generate", "UUIDs", "in", "PHP", "if", "the", "uuid", "-", "ossp", "extension", "is", "not", "installed", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Migrations/Postgresql/Version20131203110242.php#L43-L53
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/ExceptionHandlers/PlainTextHandler.php
PlainTextHandler.handle
protected function handle($fusionPath, \Exception $exception, $referenceCode) { if (isset($referenceCode)) { return sprintf( 'Exception while rendering %s: %s (%s)', $this->formatScriptPath($fusionPath, "\n\t", false), strip_tags($exception->getMessage()), $referenceCode ); } else { return sprintf( 'Exception while rendering %s: %s', $this->formatScriptPath($fusionPath, "\n\t", false), strip_tags($exception->getMessage()) ); } }
php
protected function handle($fusionPath, \Exception $exception, $referenceCode) { if (isset($referenceCode)) { return sprintf( 'Exception while rendering %s: %s (%s)', $this->formatScriptPath($fusionPath, "\n\t", false), strip_tags($exception->getMessage()), $referenceCode ); } else { return sprintf( 'Exception while rendering %s: %s', $this->formatScriptPath($fusionPath, "\n\t", false), strip_tags($exception->getMessage()) ); } }
[ "protected", "function", "handle", "(", "$", "fusionPath", ",", "\\", "Exception", "$", "exception", ",", "$", "referenceCode", ")", "{", "if", "(", "isset", "(", "$", "referenceCode", ")", ")", "{", "return", "sprintf", "(", "'Exception while rendering %s: %s...
Handles an Exception thrown while rendering Fusion @param string $fusionPath path causing the exception @param \Exception $exception exception to handle @param integer $referenceCode @return string
[ "Handles", "an", "Exception", "thrown", "while", "rendering", "Fusion" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/ExceptionHandlers/PlainTextHandler.php#L28-L44
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/ImageController.php
ImageController.indexAction
public function indexAction($view = null, $sortBy = null, $sortDirection = null, $filter = null, $tagMode = self::TAG_GIVEN, Tag $tag = null, $searchTerm = null, $collectionMode = self::COLLECTION_GIVEN, AssetCollection $assetCollection = null, $assetSourceIdentifier = null): void { $this->view->assign('disableFilter', true); parent::indexAction($view, $sortBy, $sortDirection, 'Image', $tagMode, $tag, $searchTerm, $collectionMode, $assetCollection, $assetSourceIdentifier); }
php
public function indexAction($view = null, $sortBy = null, $sortDirection = null, $filter = null, $tagMode = self::TAG_GIVEN, Tag $tag = null, $searchTerm = null, $collectionMode = self::COLLECTION_GIVEN, AssetCollection $assetCollection = null, $assetSourceIdentifier = null): void { $this->view->assign('disableFilter', true); parent::indexAction($view, $sortBy, $sortDirection, 'Image', $tagMode, $tag, $searchTerm, $collectionMode, $assetCollection, $assetSourceIdentifier); }
[ "public", "function", "indexAction", "(", "$", "view", "=", "null", ",", "$", "sortBy", "=", "null", ",", "$", "sortDirection", "=", "null", ",", "$", "filter", "=", "null", ",", "$", "tagMode", "=", "self", "::", "TAG_GIVEN", ",", "Tag", "$", "tag",...
List existing images @param string $view @param string $sortBy @param string $sortDirection @param string $filter @param int $tagMode @param Tag $tag @param string $searchTerm @param int $collectionMode @param AssetCollection $assetCollection @param string $assetSourceIdentifier @return void @throws \Neos\Utility\Exception\FilesException
[ "List", "existing", "images" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/ImageController.php#L55-L59
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/ExceptionHandlers/AbsorbingHandler.php
AbsorbingHandler.handle
protected function handle($fusionPath, \Exception $exception, $referenceCode) { $this->systemLogger->debug('Absorbed Exception: ' . $exception->getMessage(), ['fusionPath' => $fusionPath, 'referenceCode' => $referenceCode, 'FLOW_LOG_ENVIRONMENT' => ['packageKey' => 'Neos.Fusion', 'className' => self::class, 'methodName' => 'handle']]); return ''; }
php
protected function handle($fusionPath, \Exception $exception, $referenceCode) { $this->systemLogger->debug('Absorbed Exception: ' . $exception->getMessage(), ['fusionPath' => $fusionPath, 'referenceCode' => $referenceCode, 'FLOW_LOG_ENVIRONMENT' => ['packageKey' => 'Neos.Fusion', 'className' => self::class, 'methodName' => 'handle']]); return ''; }
[ "protected", "function", "handle", "(", "$", "fusionPath", ",", "\\", "Exception", "$", "exception", ",", "$", "referenceCode", ")", "{", "$", "this", "->", "systemLogger", "->", "debug", "(", "'Absorbed Exception: '", ".", "$", "exception", "->", "getMessage"...
Returns an empty string @param string $fusionPath path causing the exception @param \Exception $exception exception to handle @param integer $referenceCode @return string
[ "Returns", "an", "empty", "string" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/ExceptionHandlers/AbsorbingHandler.php#L36-L40
train
neos/neos-development-collection
Neos.Fusion/Classes/ViewHelpers/FusionContextTrait.php
FusionContextTrait.getContextVariable
protected function getContextVariable($variableName) { $value = null; $view = $this->viewHelperVariableContainer->getView(); if ($view instanceof FusionAwareViewInterface) { $fusionObject = $view->getFusionObject(); $currentContext = $fusionObject->getRuntime()->getCurrentContext(); if (isset($currentContext[$variableName])) { $value = $currentContext[$variableName]; } } return $value; }
php
protected function getContextVariable($variableName) { $value = null; $view = $this->viewHelperVariableContainer->getView(); if ($view instanceof FusionAwareViewInterface) { $fusionObject = $view->getFusionObject(); $currentContext = $fusionObject->getRuntime()->getCurrentContext(); if (isset($currentContext[$variableName])) { $value = $currentContext[$variableName]; } } return $value; }
[ "protected", "function", "getContextVariable", "(", "$", "variableName", ")", "{", "$", "value", "=", "null", ";", "$", "view", "=", "$", "this", "->", "viewHelperVariableContainer", "->", "getView", "(", ")", ";", "if", "(", "$", "view", "instanceof", "Fu...
Get a variable value from the Fusion runtime context. Note: This will return NULL if the variable didn't exist. @see hasContextVariable() @param string $variableName @return mixed
[ "Get", "a", "variable", "value", "from", "the", "Fusion", "runtime", "context", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/ViewHelpers/FusionContextTrait.php#L35-L49
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php
NodeTypeManager.getNodeTypes
public function getNodeTypes($includeAbstractNodeTypes = true) { if ($this->cachedNodeTypes === []) { $this->loadNodeTypes(); } if ($includeAbstractNodeTypes) { return $this->cachedNodeTypes; } $nonAbstractNodeTypes = array_filter($this->cachedNodeTypes, function ($nodeType) { return !$nodeType->isAbstract(); }); return $nonAbstractNodeTypes; }
php
public function getNodeTypes($includeAbstractNodeTypes = true) { if ($this->cachedNodeTypes === []) { $this->loadNodeTypes(); } if ($includeAbstractNodeTypes) { return $this->cachedNodeTypes; } $nonAbstractNodeTypes = array_filter($this->cachedNodeTypes, function ($nodeType) { return !$nodeType->isAbstract(); }); return $nonAbstractNodeTypes; }
[ "public", "function", "getNodeTypes", "(", "$", "includeAbstractNodeTypes", "=", "true", ")", "{", "if", "(", "$", "this", "->", "cachedNodeTypes", "===", "[", "]", ")", "{", "$", "this", "->", "loadNodeTypes", "(", ")", ";", "}", "if", "(", "$", "incl...
Return all registered node types. @param boolean $includeAbstractNodeTypes Whether to include abstract node types, defaults to true @return array<NodeType> All node types registered in the system, indexed by node type name @api
[ "Return", "all", "registered", "node", "types", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php#L75-L89
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php
NodeTypeManager.hasNodeType
public function hasNodeType($nodeTypeName) { if ($this->cachedNodeTypes === []) { $this->loadNodeTypes(); } return isset($this->cachedNodeTypes[$nodeTypeName]); }
php
public function hasNodeType($nodeTypeName) { if ($this->cachedNodeTypes === []) { $this->loadNodeTypes(); } return isset($this->cachedNodeTypes[$nodeTypeName]); }
[ "public", "function", "hasNodeType", "(", "$", "nodeTypeName", ")", "{", "if", "(", "$", "this", "->", "cachedNodeTypes", "===", "[", "]", ")", "{", "$", "this", "->", "loadNodeTypes", "(", ")", ";", "}", "return", "isset", "(", "$", "this", "->", "c...
Checks if the specified node type exists @param string $nodeTypeName Name of the node type @return boolean true if it exists, otherwise false @api
[ "Checks", "if", "the", "specified", "node", "type", "exists" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php#L160-L166
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php
NodeTypeManager.loadNodeTypes
protected function loadNodeTypes() { $this->fullNodeTypeConfigurations = $this->fullConfigurationCache->get('fullNodeTypeConfigurations'); $fillFullConfigurationCache = !is_array($this->fullNodeTypeConfigurations); $completeNodeTypeConfiguration = $this->configurationManager->getConfiguration('NodeTypes'); foreach (array_keys($completeNodeTypeConfiguration) as $nodeTypeName) { if (!is_array($completeNodeTypeConfiguration[$nodeTypeName])) { continue; } $nodeType = $this->loadNodeType($nodeTypeName, $completeNodeTypeConfiguration, (isset($this->fullNodeTypeConfigurations[$nodeTypeName]) ? $this->fullNodeTypeConfigurations[$nodeTypeName] : null)); if ($fillFullConfigurationCache) { $this->fullNodeTypeConfigurations[$nodeTypeName] = $nodeType->getFullConfiguration(); } } if ($fillFullConfigurationCache) { $this->fullConfigurationCache->set('fullNodeTypeConfigurations', $this->fullNodeTypeConfigurations); } $this->fullNodeTypeConfigurations = null; }
php
protected function loadNodeTypes() { $this->fullNodeTypeConfigurations = $this->fullConfigurationCache->get('fullNodeTypeConfigurations'); $fillFullConfigurationCache = !is_array($this->fullNodeTypeConfigurations); $completeNodeTypeConfiguration = $this->configurationManager->getConfiguration('NodeTypes'); foreach (array_keys($completeNodeTypeConfiguration) as $nodeTypeName) { if (!is_array($completeNodeTypeConfiguration[$nodeTypeName])) { continue; } $nodeType = $this->loadNodeType($nodeTypeName, $completeNodeTypeConfiguration, (isset($this->fullNodeTypeConfigurations[$nodeTypeName]) ? $this->fullNodeTypeConfigurations[$nodeTypeName] : null)); if ($fillFullConfigurationCache) { $this->fullNodeTypeConfigurations[$nodeTypeName] = $nodeType->getFullConfiguration(); } } if ($fillFullConfigurationCache) { $this->fullConfigurationCache->set('fullNodeTypeConfigurations', $this->fullNodeTypeConfigurations); } $this->fullNodeTypeConfigurations = null; }
[ "protected", "function", "loadNodeTypes", "(", ")", "{", "$", "this", "->", "fullNodeTypeConfigurations", "=", "$", "this", "->", "fullConfigurationCache", "->", "get", "(", "'fullNodeTypeConfigurations'", ")", ";", "$", "fillFullConfigurationCache", "=", "!", "is_a...
Loads all node types into memory. @return void
[ "Loads", "all", "node", "types", "into", "memory", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php#L185-L206
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php
NodeTypeManager.overrideNodeTypes
public function overrideNodeTypes(array $completeNodeTypeConfiguration) { $this->cachedNodeTypes = []; foreach (array_keys($completeNodeTypeConfiguration) as $nodeTypeName) { $this->loadNodeType($nodeTypeName, $completeNodeTypeConfiguration); } }
php
public function overrideNodeTypes(array $completeNodeTypeConfiguration) { $this->cachedNodeTypes = []; foreach (array_keys($completeNodeTypeConfiguration) as $nodeTypeName) { $this->loadNodeType($nodeTypeName, $completeNodeTypeConfiguration); } }
[ "public", "function", "overrideNodeTypes", "(", "array", "$", "completeNodeTypeConfiguration", ")", "{", "$", "this", "->", "cachedNodeTypes", "=", "[", "]", ";", "foreach", "(", "array_keys", "(", "$", "completeNodeTypeConfiguration", ")", "as", "$", "nodeTypeNam...
This method can be used by Functional of Behavioral Tests to completely override the node types known in the system. In order to reset the node type override, an empty array can be passed in. In this case, the system-node-types are used again. @param array $completeNodeTypeConfiguration @return void
[ "This", "method", "can", "be", "used", "by", "Functional", "of", "Behavioral", "Tests", "to", "completely", "override", "the", "node", "types", "known", "in", "the", "system", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php#L218-L224
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php
NodeTypeManager.loadNodeType
protected function loadNodeType($nodeTypeName, array &$completeNodeTypeConfiguration, array $fullNodeTypeConfigurationForType = null) { if (isset($this->cachedNodeTypes[$nodeTypeName])) { return $this->cachedNodeTypes[$nodeTypeName]; } if (!isset($completeNodeTypeConfiguration[$nodeTypeName])) { throw new Exception('Node type "' . $nodeTypeName . '" does not exist', 1316451800); } $nodeTypeConfiguration = $completeNodeTypeConfiguration[$nodeTypeName]; try { $superTypes = isset($nodeTypeConfiguration['superTypes']) ? $this->evaluateSuperTypesConfiguration($nodeTypeConfiguration['superTypes'], $completeNodeTypeConfiguration) : []; } catch (NodeConfigurationException $exception) { throw new NodeConfigurationException('Node type "' . $nodeTypeName . '" sets super type with a non-string key to NULL.', 1416578395); } catch (NodeTypeIsFinalException $exception) { throw new NodeTypeIsFinalException('Node type "' . $nodeTypeName . '" has a super type "' . $exception->getMessage() . '" which is final.', 1316452423); } // Remove unset properties $properties = []; if (isset($nodeTypeConfiguration['properties']) && is_array($nodeTypeConfiguration['properties'])) { $properties = $nodeTypeConfiguration['properties']; } $nodeTypeConfiguration['properties'] = array_filter($properties, function ($propertyConfiguration) { return $propertyConfiguration !== null; }); if ($nodeTypeConfiguration['properties'] === []) { unset($nodeTypeConfiguration['properties']); } $nodeType = new NodeType($nodeTypeName, $superTypes, $nodeTypeConfiguration); $this->cachedNodeTypes[$nodeTypeName] = $nodeType; return $nodeType; }
php
protected function loadNodeType($nodeTypeName, array &$completeNodeTypeConfiguration, array $fullNodeTypeConfigurationForType = null) { if (isset($this->cachedNodeTypes[$nodeTypeName])) { return $this->cachedNodeTypes[$nodeTypeName]; } if (!isset($completeNodeTypeConfiguration[$nodeTypeName])) { throw new Exception('Node type "' . $nodeTypeName . '" does not exist', 1316451800); } $nodeTypeConfiguration = $completeNodeTypeConfiguration[$nodeTypeName]; try { $superTypes = isset($nodeTypeConfiguration['superTypes']) ? $this->evaluateSuperTypesConfiguration($nodeTypeConfiguration['superTypes'], $completeNodeTypeConfiguration) : []; } catch (NodeConfigurationException $exception) { throw new NodeConfigurationException('Node type "' . $nodeTypeName . '" sets super type with a non-string key to NULL.', 1416578395); } catch (NodeTypeIsFinalException $exception) { throw new NodeTypeIsFinalException('Node type "' . $nodeTypeName . '" has a super type "' . $exception->getMessage() . '" which is final.', 1316452423); } // Remove unset properties $properties = []; if (isset($nodeTypeConfiguration['properties']) && is_array($nodeTypeConfiguration['properties'])) { $properties = $nodeTypeConfiguration['properties']; } $nodeTypeConfiguration['properties'] = array_filter($properties, function ($propertyConfiguration) { return $propertyConfiguration !== null; }); if ($nodeTypeConfiguration['properties'] === []) { unset($nodeTypeConfiguration['properties']); } $nodeType = new NodeType($nodeTypeName, $superTypes, $nodeTypeConfiguration); $this->cachedNodeTypes[$nodeTypeName] = $nodeType; return $nodeType; }
[ "protected", "function", "loadNodeType", "(", "$", "nodeTypeName", ",", "array", "&", "$", "completeNodeTypeConfiguration", ",", "array", "$", "fullNodeTypeConfigurationForType", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "cachedNodeTypes",...
Load one node type, if it is not loaded yet. @param string $nodeTypeName @param array $completeNodeTypeConfiguration the full node type configuration for all node types @param array $fullNodeTypeConfigurationForType @return NodeType @throws NodeConfigurationException @throws NodeTypeIsFinalException @throws Exception
[ "Load", "one", "node", "type", "if", "it", "is", "not", "loaded", "yet", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php#L237-L274
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php
NodeTypeManager.evaluateSuperTypesConfiguration
protected function evaluateSuperTypesConfiguration(array $superTypesConfiguration, &$completeNodeTypeConfiguration) { $superTypes = []; foreach ($superTypesConfiguration as $superTypeName => $enabled) { $superTypes[$superTypeName] = $this->evaluateSuperTypeConfiguration($superTypeName, $enabled, $completeNodeTypeConfiguration); } return $superTypes; }
php
protected function evaluateSuperTypesConfiguration(array $superTypesConfiguration, &$completeNodeTypeConfiguration) { $superTypes = []; foreach ($superTypesConfiguration as $superTypeName => $enabled) { $superTypes[$superTypeName] = $this->evaluateSuperTypeConfiguration($superTypeName, $enabled, $completeNodeTypeConfiguration); } return $superTypes; }
[ "protected", "function", "evaluateSuperTypesConfiguration", "(", "array", "$", "superTypesConfiguration", ",", "&", "$", "completeNodeTypeConfiguration", ")", "{", "$", "superTypes", "=", "[", "]", ";", "foreach", "(", "$", "superTypesConfiguration", "as", "$", "sup...
Evaluates the given superTypes configuation and returns the array of effective superTypes. @param array $superTypesConfiguration @param array $completeNodeTypeConfiguration @return array
[ "Evaluates", "the", "given", "superTypes", "configuation", "and", "returns", "the", "array", "of", "effective", "superTypes", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php#L283-L291
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php
NodeTypeManager.evaluateSuperTypeConfiguration
protected function evaluateSuperTypeConfiguration($superTypeName, $enabled, &$completeNodeTypeConfiguration) { // Skip unset node types if ($enabled === false || $enabled === null) { return null; } // Make this setting backwards compatible with old array schema (deprecated since 2.0) if (!is_bool($enabled)) { $superTypeName = $enabled; } // when removing super types by setting them to null, only string keys can be overridden if ($superTypeName === null) { throw new NodeConfigurationException('Node type sets super type with a non-string key to NULL.', 1444944152); } $superType = $this->loadNodeType($superTypeName, $completeNodeTypeConfiguration); if ($superType->isFinal() === true) { throw new NodeTypeIsFinalException($superType->getName(), 1444944148); } return $superType; }
php
protected function evaluateSuperTypeConfiguration($superTypeName, $enabled, &$completeNodeTypeConfiguration) { // Skip unset node types if ($enabled === false || $enabled === null) { return null; } // Make this setting backwards compatible with old array schema (deprecated since 2.0) if (!is_bool($enabled)) { $superTypeName = $enabled; } // when removing super types by setting them to null, only string keys can be overridden if ($superTypeName === null) { throw new NodeConfigurationException('Node type sets super type with a non-string key to NULL.', 1444944152); } $superType = $this->loadNodeType($superTypeName, $completeNodeTypeConfiguration); if ($superType->isFinal() === true) { throw new NodeTypeIsFinalException($superType->getName(), 1444944148); } return $superType; }
[ "protected", "function", "evaluateSuperTypeConfiguration", "(", "$", "superTypeName", ",", "$", "enabled", ",", "&", "$", "completeNodeTypeConfiguration", ")", "{", "// Skip unset node types", "if", "(", "$", "enabled", "===", "false", "||", "$", "enabled", "===", ...
Evaluates a single superType configuration and returns the NodeType if enabled. @param string $superTypeName @param boolean $enabled @param array $completeNodeTypeConfiguration @return NodeType @throws NodeConfigurationException @throws NodeTypeIsFinalException
[ "Evaluates", "a", "single", "superType", "configuration", "and", "returns", "the", "NodeType", "if", "enabled", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/NodeTypeManager.php#L303-L326
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Migration/Service/NodeTransformation.php
NodeTransformation.execute
public function execute(NodeData $nodeData, array $transformationConfigurations) { $transformationConjunction = $this->buildTransformationConjunction($transformationConfigurations); foreach ($transformationConjunction as $transformation) { if ($transformation->isTransformable($nodeData)) { $transformation->execute($nodeData); } } }
php
public function execute(NodeData $nodeData, array $transformationConfigurations) { $transformationConjunction = $this->buildTransformationConjunction($transformationConfigurations); foreach ($transformationConjunction as $transformation) { if ($transformation->isTransformable($nodeData)) { $transformation->execute($nodeData); } } }
[ "public", "function", "execute", "(", "NodeData", "$", "nodeData", ",", "array", "$", "transformationConfigurations", ")", "{", "$", "transformationConjunction", "=", "$", "this", "->", "buildTransformationConjunction", "(", "$", "transformationConfigurations", ")", "...
Executes all configured transformations starting on the given node. @param NodeData $nodeData @param array $transformationConfigurations @return void
[ "Executes", "all", "configured", "transformations", "starting", "on", "the", "given", "node", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Service/NodeTransformation.php#L46-L54
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Migration/Service/NodeTransformation.php
NodeTransformation.buildTransformationObject
protected function buildTransformationObject($transformationConfiguration) { $transformationClassName = $this->resolveTransformationClassName($transformationConfiguration['type']); $transformation = new $transformationClassName(); if (isset($transformationConfiguration['settings']) && is_array($transformationConfiguration['settings'])) { foreach ($transformationConfiguration['settings'] as $settingName => $settingValue) { if (!ObjectAccess::setProperty($transformation, $settingName, $settingValue)) { throw new MigrationException('Cannot set setting "' . $settingName . '" on transformation "' . $transformationClassName . '" , check your configuration.', 1343293094); } } } return $transformation; }
php
protected function buildTransformationObject($transformationConfiguration) { $transformationClassName = $this->resolveTransformationClassName($transformationConfiguration['type']); $transformation = new $transformationClassName(); if (isset($transformationConfiguration['settings']) && is_array($transformationConfiguration['settings'])) { foreach ($transformationConfiguration['settings'] as $settingName => $settingValue) { if (!ObjectAccess::setProperty($transformation, $settingName, $settingValue)) { throw new MigrationException('Cannot set setting "' . $settingName . '" on transformation "' . $transformationClassName . '" , check your configuration.', 1343293094); } } } return $transformation; }
[ "protected", "function", "buildTransformationObject", "(", "$", "transformationConfiguration", ")", "{", "$", "transformationClassName", "=", "$", "this", "->", "resolveTransformationClassName", "(", "$", "transformationConfiguration", "[", "'type'", "]", ")", ";", "$",...
Builds a transformation object from the given configuration. @param array $transformationConfiguration @return TransformationInterface @throws MigrationException if a given setting is not supported
[ "Builds", "a", "transformation", "object", "from", "the", "given", "configuration", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Service/NodeTransformation.php#L83-L97
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Migration/Service/NodeTransformation.php
NodeTransformation.resolveTransformationClassName
protected function resolveTransformationClassName($transformationName) { $resolvedObjectName = $this->objectManager->getCaseSensitiveObjectName($transformationName); if ($resolvedObjectName !== false) { return $resolvedObjectName; } $resolvedObjectName = $this->objectManager->getCaseSensitiveObjectName('Neos\ContentRepository\Migration\Transformations\\' . $transformationName); if ($resolvedObjectName !== false) { return $resolvedObjectName; } throw new MigrationException('A transformation with the name "' . $transformationName . '" could not be found.', 1343293064); }
php
protected function resolveTransformationClassName($transformationName) { $resolvedObjectName = $this->objectManager->getCaseSensitiveObjectName($transformationName); if ($resolvedObjectName !== false) { return $resolvedObjectName; } $resolvedObjectName = $this->objectManager->getCaseSensitiveObjectName('Neos\ContentRepository\Migration\Transformations\\' . $transformationName); if ($resolvedObjectName !== false) { return $resolvedObjectName; } throw new MigrationException('A transformation with the name "' . $transformationName . '" could not be found.', 1343293064); }
[ "protected", "function", "resolveTransformationClassName", "(", "$", "transformationName", ")", "{", "$", "resolvedObjectName", "=", "$", "this", "->", "objectManager", "->", "getCaseSensitiveObjectName", "(", "$", "transformationName", ")", ";", "if", "(", "$", "re...
Tries to resolve the given transformation name into a class name. The name can be a fully qualified class name or a name relative to the Neos\ContentRepository\Migration\Transformations namespace. @param string $transformationName @return string @throws MigrationException
[ "Tries", "to", "resolve", "the", "given", "transformation", "name", "into", "a", "class", "name", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Service/NodeTransformation.php#L109-L122
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/FusionService.php
FusionService.createRuntime
public function createRuntime(TraversableNodeInterface $currentSiteNode, ControllerContext $controllerContext) { $fusionObjectTree = $this->getMergedFusionObjectTree($currentSiteNode); $fusionRuntime = new Runtime($fusionObjectTree, $controllerContext); return $fusionRuntime; }
php
public function createRuntime(TraversableNodeInterface $currentSiteNode, ControllerContext $controllerContext) { $fusionObjectTree = $this->getMergedFusionObjectTree($currentSiteNode); $fusionRuntime = new Runtime($fusionObjectTree, $controllerContext); return $fusionRuntime; }
[ "public", "function", "createRuntime", "(", "TraversableNodeInterface", "$", "currentSiteNode", ",", "ControllerContext", "$", "controllerContext", ")", "{", "$", "fusionObjectTree", "=", "$", "this", "->", "getMergedFusionObjectTree", "(", "$", "currentSiteNode", ")", ...
Create a runtime for the given site node @param TraversableNodeInterface $currentSiteNode @param ControllerContext $controllerContext @return Runtime @throws \Neos\Fusion\Exception @throws \Neos\Neos\Domain\Exception
[ "Create", "a", "runtime", "for", "the", "given", "site", "node" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/FusionService.php#L121-L126
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/FusionService.php
FusionService.getMergedFusionObjectTree
public function getMergedFusionObjectTree(TraversableNodeInterface $startNode) { $siteResourcesPackageKey = $this->getSiteForSiteNode($startNode)->getSiteResourcesPackageKey(); $siteRootFusionPathAndFilename = sprintf($this->siteRootFusionPattern, $siteResourcesPackageKey); $siteRootFusionCode = $this->readExternalFusionFile($siteRootFusionPathAndFilename); $mergedFusionCode = ''; $mergedFusionCode .= $this->generateNodeTypeDefinitions(); $mergedFusionCode .= $this->getFusionIncludes($this->prepareAutoIncludeFusion()); $mergedFusionCode .= $this->getFusionIncludes($this->prependFusionIncludes); $mergedFusionCode .= $siteRootFusionCode; $mergedFusionCode .= $this->getFusionIncludes($this->appendFusionIncludes); return $this->fusionParser->parse($mergedFusionCode, $siteRootFusionPathAndFilename); }
php
public function getMergedFusionObjectTree(TraversableNodeInterface $startNode) { $siteResourcesPackageKey = $this->getSiteForSiteNode($startNode)->getSiteResourcesPackageKey(); $siteRootFusionPathAndFilename = sprintf($this->siteRootFusionPattern, $siteResourcesPackageKey); $siteRootFusionCode = $this->readExternalFusionFile($siteRootFusionPathAndFilename); $mergedFusionCode = ''; $mergedFusionCode .= $this->generateNodeTypeDefinitions(); $mergedFusionCode .= $this->getFusionIncludes($this->prepareAutoIncludeFusion()); $mergedFusionCode .= $this->getFusionIncludes($this->prependFusionIncludes); $mergedFusionCode .= $siteRootFusionCode; $mergedFusionCode .= $this->getFusionIncludes($this->appendFusionIncludes); return $this->fusionParser->parse($mergedFusionCode, $siteRootFusionPathAndFilename); }
[ "public", "function", "getMergedFusionObjectTree", "(", "TraversableNodeInterface", "$", "startNode", ")", "{", "$", "siteResourcesPackageKey", "=", "$", "this", "->", "getSiteForSiteNode", "(", "$", "startNode", ")", "->", "getSiteResourcesPackageKey", "(", ")", ";",...
Returns a merged Fusion object tree in the context of the given nodes @param TraversableNodeInterface $startNode Node marking the starting point (i.e. the "Site" node) @return array The merged object tree as of the given node @throws \Neos\Neos\Domain\Exception @throws \Neos\Fusion\Exception
[ "Returns", "a", "merged", "Fusion", "object", "tree", "in", "the", "context", "of", "the", "given", "nodes" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/FusionService.php#L136-L151
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/FusionService.php
FusionService.generateNodeTypeDefinitions
protected function generateNodeTypeDefinitions() { $code = ''; /** @var NodeType $nodeType */ foreach ($this->nodeTypeManager->getNodeTypes(false) as $nodeType) { $code .= $this->generateFusionForNodeType($nodeType); } return $code; }
php
protected function generateNodeTypeDefinitions() { $code = ''; /** @var NodeType $nodeType */ foreach ($this->nodeTypeManager->getNodeTypes(false) as $nodeType) { $code .= $this->generateFusionForNodeType($nodeType); } return $code; }
[ "protected", "function", "generateNodeTypeDefinitions", "(", ")", "{", "$", "code", "=", "''", ";", "/** @var NodeType $nodeType */", "foreach", "(", "$", "this", "->", "nodeTypeManager", "->", "getNodeTypes", "(", "false", ")", "as", "$", "nodeType", ")", "{", ...
Generate Fusion prototype definitions for all node types Only fully qualified node types (e.g. MyVendor.MyPackage:NodeType) will be considered. @return string @throws \Neos\Neos\Domain\Exception
[ "Generate", "Fusion", "prototype", "definitions", "for", "all", "node", "types" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/FusionService.php#L182-L190
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/FusionService.php
FusionService.getFusionIncludes
protected function getFusionIncludes(array $fusionResources) { $code = chr(10); foreach ($fusionResources as $fusionResource) { $code .= 'include: ' . (string)$fusionResource . chr(10); } $code .= chr(10); return $code; }
php
protected function getFusionIncludes(array $fusionResources) { $code = chr(10); foreach ($fusionResources as $fusionResource) { $code .= 'include: ' . (string)$fusionResource . chr(10); } $code .= chr(10); return $code; }
[ "protected", "function", "getFusionIncludes", "(", "array", "$", "fusionResources", ")", "{", "$", "code", "=", "chr", "(", "10", ")", ";", "foreach", "(", "$", "fusionResources", "as", "$", "fusionResource", ")", "{", "$", "code", ".=", "'include: '", "."...
Concatenate the given Fusion resources with include statements @param array $fusionResources An array of Fusion resource URIs @return string A string of include statements for all resources
[ "Concatenate", "the", "given", "Fusion", "resources", "with", "include", "statements" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/FusionService.php#L224-L232
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/FusionService.php
FusionService.prepareAutoIncludeFusion
protected function prepareAutoIncludeFusion() { $autoIncludeFusion = []; foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) { if (isset($this->autoIncludeConfiguration[$packageKey]) && $this->autoIncludeConfiguration[$packageKey] === true) { $autoIncludeFusionFile = sprintf($this->autoIncludeFusionPattern, $packageKey); if (is_file($autoIncludeFusionFile)) { $autoIncludeFusion[] = $autoIncludeFusionFile; } } } return $autoIncludeFusion; }
php
protected function prepareAutoIncludeFusion() { $autoIncludeFusion = []; foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) { if (isset($this->autoIncludeConfiguration[$packageKey]) && $this->autoIncludeConfiguration[$packageKey] === true) { $autoIncludeFusionFile = sprintf($this->autoIncludeFusionPattern, $packageKey); if (is_file($autoIncludeFusionFile)) { $autoIncludeFusion[] = $autoIncludeFusionFile; } } } return $autoIncludeFusion; }
[ "protected", "function", "prepareAutoIncludeFusion", "(", ")", "{", "$", "autoIncludeFusion", "=", "[", "]", ";", "foreach", "(", "array_keys", "(", "$", "this", "->", "packageManager", "->", "getAvailablePackages", "(", ")", ")", "as", "$", "packageKey", ")",...
Prepares an array with Fusion paths to auto include before the Site Fusion. @return array
[ "Prepares", "an", "array", "with", "Fusion", "paths", "to", "auto", "include", "before", "the", "Site", "Fusion", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/FusionService.php#L239-L252
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/PublishingService.php
PublishingService.getUnpublishedNodes
public function getUnpublishedNodes(Workspace $workspace) { if ($workspace->getBaseWorkspace() === null) { return []; } $nodeData = $this->nodeDataRepository->findByWorkspace($workspace); $unpublishedNodes = []; foreach ($nodeData as $singleNodeData) { /** @var NodeData $singleNodeData */ // Skip the root entry from the workspace as it can't be published if ($singleNodeData->getPath() === '/') { continue; } $node = $this->nodeFactory->createFromNodeData($singleNodeData, $this->createContext($workspace, $singleNodeData->getDimensionValues())); if ($node !== null) { $unpublishedNodes[] = $node; } } $unpublishedNodes = $this->sortNodesForPublishing($unpublishedNodes); return $unpublishedNodes; }
php
public function getUnpublishedNodes(Workspace $workspace) { if ($workspace->getBaseWorkspace() === null) { return []; } $nodeData = $this->nodeDataRepository->findByWorkspace($workspace); $unpublishedNodes = []; foreach ($nodeData as $singleNodeData) { /** @var NodeData $singleNodeData */ // Skip the root entry from the workspace as it can't be published if ($singleNodeData->getPath() === '/') { continue; } $node = $this->nodeFactory->createFromNodeData($singleNodeData, $this->createContext($workspace, $singleNodeData->getDimensionValues())); if ($node !== null) { $unpublishedNodes[] = $node; } } $unpublishedNodes = $this->sortNodesForPublishing($unpublishedNodes); return $unpublishedNodes; }
[ "public", "function", "getUnpublishedNodes", "(", "Workspace", "$", "workspace", ")", "{", "if", "(", "$", "workspace", "->", "getBaseWorkspace", "(", ")", "===", "null", ")", "{", "return", "[", "]", ";", "}", "$", "nodeData", "=", "$", "this", "->", ...
Returns a list of nodes contained in the given workspace which are not yet published @param Workspace $workspace @return array<\Neos\ContentRepository\Domain\Model\NodeInterface> @api
[ "Returns", "a", "list", "of", "nodes", "contained", "in", "the", "given", "workspace", "which", "are", "not", "yet", "published" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php#L69-L92
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/PublishingService.php
PublishingService.publishNode
public function publishNode(NodeInterface $node, Workspace $targetWorkspace = null) { if ($targetWorkspace === null) { $targetWorkspace = $node->getWorkspace()->getBaseWorkspace(); } if ($targetWorkspace instanceof Workspace) { $node->getWorkspace()->publishNode($node, $targetWorkspace); $this->emitNodePublished($node, $targetWorkspace); } }
php
public function publishNode(NodeInterface $node, Workspace $targetWorkspace = null) { if ($targetWorkspace === null) { $targetWorkspace = $node->getWorkspace()->getBaseWorkspace(); } if ($targetWorkspace instanceof Workspace) { $node->getWorkspace()->publishNode($node, $targetWorkspace); $this->emitNodePublished($node, $targetWorkspace); } }
[ "public", "function", "publishNode", "(", "NodeInterface", "$", "node", ",", "Workspace", "$", "targetWorkspace", "=", "null", ")", "{", "if", "(", "$", "targetWorkspace", "===", "null", ")", "{", "$", "targetWorkspace", "=", "$", "node", "->", "getWorkspace...
Publishes the given node to the specified target workspace. If no workspace is specified, the source workspace's base workspace is assumed. @param NodeInterface $node @param Workspace $targetWorkspace If not set the base workspace is assumed to be the publishing target @return void @api
[ "Publishes", "the", "given", "node", "to", "the", "specified", "target", "workspace", ".", "If", "no", "workspace", "is", "specified", "the", "source", "workspace", "s", "base", "workspace", "is", "assumed", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php#L115-L124
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/PublishingService.php
PublishingService.publishNodes
public function publishNodes(array $nodes, Workspace $targetWorkspace = null) { $nodes = $this->sortNodesForPublishing($nodes); foreach ($nodes as $node) { $this->publishNode($node, $targetWorkspace); } }
php
public function publishNodes(array $nodes, Workspace $targetWorkspace = null) { $nodes = $this->sortNodesForPublishing($nodes); foreach ($nodes as $node) { $this->publishNode($node, $targetWorkspace); } }
[ "public", "function", "publishNodes", "(", "array", "$", "nodes", ",", "Workspace", "$", "targetWorkspace", "=", "null", ")", "{", "$", "nodes", "=", "$", "this", "->", "sortNodesForPublishing", "(", "$", "nodes", ")", ";", "foreach", "(", "$", "nodes", ...
Publishes the given nodes to the specified target workspace. If no workspace is specified, the source workspace's base workspace is assumed. @param array<\Neos\ContentRepository\Domain\Model\NodeInterface> $nodes The nodes to publish @param Workspace $targetWorkspace If not set the base workspace is assumed to be the publishing target @return void @api
[ "Publishes", "the", "given", "nodes", "to", "the", "specified", "target", "workspace", ".", "If", "no", "workspace", "is", "specified", "the", "source", "workspace", "s", "base", "workspace", "is", "assumed", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php#L135-L141
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/PublishingService.php
PublishingService.doDiscardNode
protected function doDiscardNode(NodeInterface $node, array &$alreadyDiscardedNodeIdentifiers = []) { if ($node->getWorkspace()->getBaseWorkspace() === null) { throw new WorkspaceException('Nodes in a workspace without a base workspace cannot be discarded.', 1395841899); } if ($node->getPath() === '/') { return; } if (array_search($node->getIdentifier(), $alreadyDiscardedNodeIdentifiers) !== false) { return; } $alreadyDiscardedNodeIdentifiers[] = $node->getIdentifier(); $possibleShadowNodeData = $this->nodeDataRepository->findOneByMovedTo($node->getNodeData()); if ($possibleShadowNodeData instanceof NodeData) { if ($possibleShadowNodeData->getMovedTo() !== null) { $parentBasePath = $node->getPath(); $affectedChildNodeDataInSameWorkspace = $this->nodeDataRepository->findByParentAndNodeType($parentBasePath, null, $node->getWorkspace(), null, false, true); foreach ($affectedChildNodeDataInSameWorkspace as $affectedChildNodeData) { /** @var NodeData $affectedChildNodeData */ $affectedChildNode = $this->nodeFactory->createFromNodeData($affectedChildNodeData, $node->getContext()); $this->doDiscardNode($affectedChildNode, $alreadyDiscardedNodeIdentifiers); } } $this->nodeDataRepository->remove($possibleShadowNodeData); } $this->nodeDataRepository->remove($node); $this->emitNodeDiscarded($node); }
php
protected function doDiscardNode(NodeInterface $node, array &$alreadyDiscardedNodeIdentifiers = []) { if ($node->getWorkspace()->getBaseWorkspace() === null) { throw new WorkspaceException('Nodes in a workspace without a base workspace cannot be discarded.', 1395841899); } if ($node->getPath() === '/') { return; } if (array_search($node->getIdentifier(), $alreadyDiscardedNodeIdentifiers) !== false) { return; } $alreadyDiscardedNodeIdentifiers[] = $node->getIdentifier(); $possibleShadowNodeData = $this->nodeDataRepository->findOneByMovedTo($node->getNodeData()); if ($possibleShadowNodeData instanceof NodeData) { if ($possibleShadowNodeData->getMovedTo() !== null) { $parentBasePath = $node->getPath(); $affectedChildNodeDataInSameWorkspace = $this->nodeDataRepository->findByParentAndNodeType($parentBasePath, null, $node->getWorkspace(), null, false, true); foreach ($affectedChildNodeDataInSameWorkspace as $affectedChildNodeData) { /** @var NodeData $affectedChildNodeData */ $affectedChildNode = $this->nodeFactory->createFromNodeData($affectedChildNodeData, $node->getContext()); $this->doDiscardNode($affectedChildNode, $alreadyDiscardedNodeIdentifiers); } } $this->nodeDataRepository->remove($possibleShadowNodeData); } $this->nodeDataRepository->remove($node); $this->emitNodeDiscarded($node); }
[ "protected", "function", "doDiscardNode", "(", "NodeInterface", "$", "node", ",", "array", "&", "$", "alreadyDiscardedNodeIdentifiers", "=", "[", "]", ")", "{", "if", "(", "$", "node", "->", "getWorkspace", "(", ")", "->", "getBaseWorkspace", "(", ")", "==="...
Method which does the actual work of discarding, includes a protection against endless recursions and multiple discarding of the same node. @param NodeInterface $node The node to discard @param array &$alreadyDiscardedNodeIdentifiers List of node identifiers which already have been discarded during one discardNode() run @return void @throws \Neos\ContentRepository\Exception\WorkspaceException
[ "Method", "which", "does", "the", "actual", "work", "of", "discarding", "includes", "a", "protection", "against", "endless", "recursions", "and", "multiple", "discarding", "of", "the", "same", "node", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php#L167-L198
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/PublishingService.php
PublishingService.discardNodes
public function discardNodes(array $nodes) { $discardedNodeIdentifiers = []; foreach ($nodes as $node) { $this->doDiscardNode($node, $discardedNodeIdentifiers); } }
php
public function discardNodes(array $nodes) { $discardedNodeIdentifiers = []; foreach ($nodes as $node) { $this->doDiscardNode($node, $discardedNodeIdentifiers); } }
[ "public", "function", "discardNodes", "(", "array", "$", "nodes", ")", "{", "$", "discardedNodeIdentifiers", "=", "[", "]", ";", "foreach", "(", "$", "nodes", "as", "$", "node", ")", "{", "$", "this", "->", "doDiscardNode", "(", "$", "node", ",", "$", ...
Discards the given nodes. @param array<\Neos\ContentRepository\Domain\Model\NodeInterface> $nodes The nodes to discard @return void @api
[ "Discards", "the", "given", "nodes", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php#L207-L213
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/PublishingService.php
PublishingService.discardAllNodes
public function discardAllNodes(Workspace $workspace) { if ($workspace->getName() === 'live') { throw new WorkspaceException('Nodes in the live workspace cannot be discarded.', 1428937112); } foreach ($this->getUnpublishedNodes($workspace) as $node) { /** @var NodeInterface $node */ if ($node->getPath() !== '/') { $this->discardNode($node); } } }
php
public function discardAllNodes(Workspace $workspace) { if ($workspace->getName() === 'live') { throw new WorkspaceException('Nodes in the live workspace cannot be discarded.', 1428937112); } foreach ($this->getUnpublishedNodes($workspace) as $node) { /** @var NodeInterface $node */ if ($node->getPath() !== '/') { $this->discardNode($node); } } }
[ "public", "function", "discardAllNodes", "(", "Workspace", "$", "workspace", ")", "{", "if", "(", "$", "workspace", "->", "getName", "(", ")", "===", "'live'", ")", "{", "throw", "new", "WorkspaceException", "(", "'Nodes in the live workspace cannot be discarded.'",...
Discards all unpublished nodes of the given workspace. TODO: This method needs to be optimized / implemented in collaboration with a DQL-based method in NodeDataRepository @param Workspace $workspace The workspace to flush, can't be the live workspace @return void @throws WorkspaceException @api
[ "Discards", "all", "unpublished", "nodes", "of", "the", "given", "workspace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php#L225-L237
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/PublishingService.php
PublishingService.createContext
protected function createContext(Workspace $workspace, array $dimensionValues, array $contextProperties = []) { $presetsMatchingDimensionValues = $this->contentDimensionPresetSource->findPresetsByTargetValues($dimensionValues); $dimensions = array_map(function ($preset) { return $preset['values']; }, $presetsMatchingDimensionValues); $contextProperties += [ 'workspaceName' => $workspace->getName(), 'inaccessibleContentShown' => true, 'invisibleContentShown' => true, 'removedContentShown' => true, 'dimensions' => $dimensions ]; return $this->contextFactory->create($contextProperties); }
php
protected function createContext(Workspace $workspace, array $dimensionValues, array $contextProperties = []) { $presetsMatchingDimensionValues = $this->contentDimensionPresetSource->findPresetsByTargetValues($dimensionValues); $dimensions = array_map(function ($preset) { return $preset['values']; }, $presetsMatchingDimensionValues); $contextProperties += [ 'workspaceName' => $workspace->getName(), 'inaccessibleContentShown' => true, 'invisibleContentShown' => true, 'removedContentShown' => true, 'dimensions' => $dimensions ]; return $this->contextFactory->create($contextProperties); }
[ "protected", "function", "createContext", "(", "Workspace", "$", "workspace", ",", "array", "$", "dimensionValues", ",", "array", "$", "contextProperties", "=", "[", "]", ")", "{", "$", "presetsMatchingDimensionValues", "=", "$", "this", "->", "contentDimensionPre...
Creates a new content context based on the given workspace and the NodeData object. @param Workspace $workspace Workspace for the new context @param array $dimensionValues The dimension values for the new context @param array $contextProperties Additional pre-defined context properties @return Context
[ "Creates", "a", "new", "content", "context", "based", "on", "the", "given", "workspace", "and", "the", "NodeData", "object", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php#L290-L306
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Service/AssetService.php
AssetService.getRepository
public function getRepository(AssetInterface $asset) { $assetRepositoryClassName = str_replace('\\Model\\', '\\Repository\\', get_class($asset)) . 'Repository'; if (class_exists($assetRepositoryClassName)) { return $this->objectManager->get($assetRepositoryClassName); } return $this->objectManager->get(AssetRepository::class); }
php
public function getRepository(AssetInterface $asset) { $assetRepositoryClassName = str_replace('\\Model\\', '\\Repository\\', get_class($asset)) . 'Repository'; if (class_exists($assetRepositoryClassName)) { return $this->objectManager->get($assetRepositoryClassName); } return $this->objectManager->get(AssetRepository::class); }
[ "public", "function", "getRepository", "(", "AssetInterface", "$", "asset", ")", "{", "$", "assetRepositoryClassName", "=", "str_replace", "(", "'\\\\Model\\\\'", ",", "'\\\\Repository\\\\'", ",", "get_class", "(", "$", "asset", ")", ")", ".", "'Repository'", ";",...
Returns the repository for an asset @param AssetInterface $asset @return RepositoryInterface @api
[ "Returns", "the", "repository", "for", "an", "asset" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Service/AssetService.php#L100-L109
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Service/AssetService.php
AssetService.getThumbnailUriAndSizeForAsset
public function getThumbnailUriAndSizeForAsset(AssetInterface $asset, ThumbnailConfiguration $configuration, ActionRequest $request = null) { $thumbnailImage = $this->thumbnailService->getThumbnail($asset, $configuration); if (!$thumbnailImage instanceof ImageInterface) { return null; } $resource = $thumbnailImage->getResource(); if ($thumbnailImage instanceof Thumbnail) { $staticResource = $thumbnailImage->getStaticResource(); if ($configuration->isAsync() === true && $resource === null && $staticResource === null) { if ($request === null) { throw new AssetServiceException('Request argument must be provided for async thumbnails.', 1447660835); } $this->uriBuilder->setRequest($request->getMainRequest()); $uri = $this->uriBuilder ->reset() ->setCreateAbsoluteUri(true) ->uriFor('thumbnail', ['thumbnail' => $thumbnailImage], 'Thumbnail', 'Neos.Media'); } else { $uri = $this->thumbnailService->getUriForThumbnail($thumbnailImage); } } else { $uri = $this->resourceManager->getPublicPersistentResourceUri($resource); } return [ 'width' => $thumbnailImage->getWidth(), 'height' => $thumbnailImage->getHeight(), 'src' => $uri ]; }
php
public function getThumbnailUriAndSizeForAsset(AssetInterface $asset, ThumbnailConfiguration $configuration, ActionRequest $request = null) { $thumbnailImage = $this->thumbnailService->getThumbnail($asset, $configuration); if (!$thumbnailImage instanceof ImageInterface) { return null; } $resource = $thumbnailImage->getResource(); if ($thumbnailImage instanceof Thumbnail) { $staticResource = $thumbnailImage->getStaticResource(); if ($configuration->isAsync() === true && $resource === null && $staticResource === null) { if ($request === null) { throw new AssetServiceException('Request argument must be provided for async thumbnails.', 1447660835); } $this->uriBuilder->setRequest($request->getMainRequest()); $uri = $this->uriBuilder ->reset() ->setCreateAbsoluteUri(true) ->uriFor('thumbnail', ['thumbnail' => $thumbnailImage], 'Thumbnail', 'Neos.Media'); } else { $uri = $this->thumbnailService->getUriForThumbnail($thumbnailImage); } } else { $uri = $this->resourceManager->getPublicPersistentResourceUri($resource); } return [ 'width' => $thumbnailImage->getWidth(), 'height' => $thumbnailImage->getHeight(), 'src' => $uri ]; }
[ "public", "function", "getThumbnailUriAndSizeForAsset", "(", "AssetInterface", "$", "asset", ",", "ThumbnailConfiguration", "$", "configuration", ",", "ActionRequest", "$", "request", "=", "null", ")", "{", "$", "thumbnailImage", "=", "$", "this", "->", "thumbnailSe...
Calculates the dimensions of the thumbnail to be generated and returns the thumbnail URI. In case of Images this is a thumbnail of the image, in case of other assets an icon representation. @param AssetInterface $asset @param ThumbnailConfiguration $configuration @param ActionRequest $request Request argument must be provided for asynchronous thumbnails @return array|null Array with keys "width", "height" and "src" if the thumbnail generation work or null @throws AssetServiceException @throws ThumbnailServiceException @throws MissingActionNameException
[ "Calculates", "the", "dimensions", "of", "the", "thumbnail", "to", "be", "generated", "and", "returns", "the", "thumbnail", "URI", ".", "In", "case", "of", "Images", "this", "is", "a", "thumbnail", "of", "the", "image", "in", "case", "of", "other", "assets...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Service/AssetService.php#L123-L153
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Service/AssetService.php
AssetService.getUsageStrategies
protected function getUsageStrategies() { if (is_array($this->usageStrategies)) { return $this->usageStrategies; } $this->usageStrategies = []; $assetUsageStrategyImplementations = $this->reflectionService->getAllImplementationClassNamesForInterface(AssetUsageStrategyInterface::class); foreach ($assetUsageStrategyImplementations as $assetUsageStrategyImplementationClassName) { $this->usageStrategies[] = $this->objectManager->get($assetUsageStrategyImplementationClassName); } return $this->usageStrategies; }
php
protected function getUsageStrategies() { if (is_array($this->usageStrategies)) { return $this->usageStrategies; } $this->usageStrategies = []; $assetUsageStrategyImplementations = $this->reflectionService->getAllImplementationClassNamesForInterface(AssetUsageStrategyInterface::class); foreach ($assetUsageStrategyImplementations as $assetUsageStrategyImplementationClassName) { $this->usageStrategies[] = $this->objectManager->get($assetUsageStrategyImplementationClassName); } return $this->usageStrategies; }
[ "protected", "function", "getUsageStrategies", "(", ")", "{", "if", "(", "is_array", "(", "$", "this", "->", "usageStrategies", ")", ")", "{", "return", "$", "this", "->", "usageStrategies", ";", "}", "$", "this", "->", "usageStrategies", "=", "[", "]", ...
Returns all registered asset usage strategies @return array<\Neos\Media\Domain\Strategy\AssetUsageStrategyInterface> @throws \Neos\Flow\ObjectManagement\Exception\UnknownObjectException
[ "Returns", "all", "registered", "asset", "usage", "strategies" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Service/AssetService.php#L161-L174
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Service/AssetService.php
AssetService.getUsageReferences
public function getUsageReferences(AssetInterface $asset) { $usages = []; /** @var AssetUsageStrategyInterface $strategy */ foreach ($this->getUsageStrategies() as $strategy) { $usages = Arrays::arrayMergeRecursiveOverrule($usages, $strategy->getUsageReferences($asset)); } return $usages; }
php
public function getUsageReferences(AssetInterface $asset) { $usages = []; /** @var AssetUsageStrategyInterface $strategy */ foreach ($this->getUsageStrategies() as $strategy) { $usages = Arrays::arrayMergeRecursiveOverrule($usages, $strategy->getUsageReferences($asset)); } return $usages; }
[ "public", "function", "getUsageReferences", "(", "AssetInterface", "$", "asset", ")", "{", "$", "usages", "=", "[", "]", ";", "/** @var AssetUsageStrategyInterface $strategy */", "foreach", "(", "$", "this", "->", "getUsageStrategies", "(", ")", "as", "$", "strate...
Returns an array of asset usage references. @param AssetInterface $asset @return array<\Neos\Media\Domain\Model\Dto\UsageReference>
[ "Returns", "an", "array", "of", "asset", "usage", "references", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Service/AssetService.php#L182-L191
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Service/AssetService.php
AssetService.getUsageCount
public function getUsageCount(AssetInterface $asset) { $usageCount = 0; /** @var AssetUsageStrategyInterface $strategy */ foreach ($this->getUsageStrategies() as $strategy) { $usageCount += $strategy->getUsageCount($asset); } return $usageCount; }
php
public function getUsageCount(AssetInterface $asset) { $usageCount = 0; /** @var AssetUsageStrategyInterface $strategy */ foreach ($this->getUsageStrategies() as $strategy) { $usageCount += $strategy->getUsageCount($asset); } return $usageCount; }
[ "public", "function", "getUsageCount", "(", "AssetInterface", "$", "asset", ")", "{", "$", "usageCount", "=", "0", ";", "/** @var AssetUsageStrategyInterface $strategy */", "foreach", "(", "$", "this", "->", "getUsageStrategies", "(", ")", "as", "$", "strategy", "...
Returns the total count of times an asset is used. @param AssetInterface $asset @return integer
[ "Returns", "the", "total", "count", "of", "times", "an", "asset", "is", "used", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Service/AssetService.php#L199-L208
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Service/AssetService.php
AssetService.isInUse
public function isInUse(AssetInterface $asset) { /** @var AssetUsageStrategyInterface $strategy */ foreach ($this->getUsageStrategies() as $strategy) { if ($strategy->isInUse($asset) === true) { return true; } } return false; }
php
public function isInUse(AssetInterface $asset) { /** @var AssetUsageStrategyInterface $strategy */ foreach ($this->getUsageStrategies() as $strategy) { if ($strategy->isInUse($asset) === true) { return true; } } return false; }
[ "public", "function", "isInUse", "(", "AssetInterface", "$", "asset", ")", "{", "/** @var AssetUsageStrategyInterface $strategy */", "foreach", "(", "$", "this", "->", "getUsageStrategies", "(", ")", "as", "$", "strategy", ")", "{", "if", "(", "$", "strategy", "...
Returns true if the asset is used. @param AssetInterface $asset @return boolean
[ "Returns", "true", "if", "the", "asset", "is", "used", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Service/AssetService.php#L216-L226
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Service/AssetService.php
AssetService.replaceAssetResource
public function replaceAssetResource(AssetInterface $asset, PersistentResource $resource, array $options = []) { $originalAssetResource = $asset->getResource(); $asset->setResource($resource); if (isset($options['keepOriginalFilename']) && (boolean)$options['keepOriginalFilename'] === true) { $asset->getResource()->setFilename($originalAssetResource->getFilename()); } $uriMapping = []; $redirectHandlerEnabled = isset($options['generateRedirects']) && (boolean)$options['generateRedirects'] === true && $this->packageManager->isPackageAvailable('Neos.RedirectHandler'); if ($redirectHandlerEnabled) { $originalAssetResourceUri = new Uri($this->resourceManager->getPublicPersistentResourceUri($originalAssetResource)); $newAssetResourceUri = new Uri($this->resourceManager->getPublicPersistentResourceUri($asset->getResource())); $uriMapping[$originalAssetResourceUri->getPath()] = $newAssetResourceUri->getPath(); } if (method_exists($asset, 'getVariants')) { $variants = $asset->getVariants(); /** @var AssetVariantInterface $variant */ foreach ($variants as $variant) { $originalVariantResource = $variant->getResource(); $variant->refresh(); if (method_exists($variant, 'getAdjustments')) { foreach ($variant->getAdjustments() as $adjustment) { if (method_exists($adjustment, 'refit') && $this->imageService->getImageSize($originalAssetResource) !== $this->imageService->getImageSize($resource)) { $adjustment->refit($asset); } } } if ($redirectHandlerEnabled) { $originalVariantResourceUri = new Uri($this->resourceManager->getPublicPersistentResourceUri($originalVariantResource)); $newVariantResourceUri = new Uri($this->resourceManager->getPublicPersistentResourceUri($variant->getResource())); $uriMapping[$originalVariantResourceUri->getPath()] = $newVariantResourceUri->getPath(); } $this->getRepository($variant)->update($variant); } } if ($redirectHandlerEnabled) { /** @var RedirectStorageInterface $redirectStorage */ $redirectStorage = $this->objectManager->get(RedirectStorageInterface::class); foreach ($uriMapping as $originalUri => $newUri) { $existingRedirect = $redirectStorage->getOneBySourceUriPathAndHost($originalUri); if ($existingRedirect === null) { $redirectStorage->addRedirect($originalUri, $newUri, 301); } } } $this->getRepository($asset)->update($asset); $this->emitAssetResourceReplaced($asset); }
php
public function replaceAssetResource(AssetInterface $asset, PersistentResource $resource, array $options = []) { $originalAssetResource = $asset->getResource(); $asset->setResource($resource); if (isset($options['keepOriginalFilename']) && (boolean)$options['keepOriginalFilename'] === true) { $asset->getResource()->setFilename($originalAssetResource->getFilename()); } $uriMapping = []; $redirectHandlerEnabled = isset($options['generateRedirects']) && (boolean)$options['generateRedirects'] === true && $this->packageManager->isPackageAvailable('Neos.RedirectHandler'); if ($redirectHandlerEnabled) { $originalAssetResourceUri = new Uri($this->resourceManager->getPublicPersistentResourceUri($originalAssetResource)); $newAssetResourceUri = new Uri($this->resourceManager->getPublicPersistentResourceUri($asset->getResource())); $uriMapping[$originalAssetResourceUri->getPath()] = $newAssetResourceUri->getPath(); } if (method_exists($asset, 'getVariants')) { $variants = $asset->getVariants(); /** @var AssetVariantInterface $variant */ foreach ($variants as $variant) { $originalVariantResource = $variant->getResource(); $variant->refresh(); if (method_exists($variant, 'getAdjustments')) { foreach ($variant->getAdjustments() as $adjustment) { if (method_exists($adjustment, 'refit') && $this->imageService->getImageSize($originalAssetResource) !== $this->imageService->getImageSize($resource)) { $adjustment->refit($asset); } } } if ($redirectHandlerEnabled) { $originalVariantResourceUri = new Uri($this->resourceManager->getPublicPersistentResourceUri($originalVariantResource)); $newVariantResourceUri = new Uri($this->resourceManager->getPublicPersistentResourceUri($variant->getResource())); $uriMapping[$originalVariantResourceUri->getPath()] = $newVariantResourceUri->getPath(); } $this->getRepository($variant)->update($variant); } } if ($redirectHandlerEnabled) { /** @var RedirectStorageInterface $redirectStorage */ $redirectStorage = $this->objectManager->get(RedirectStorageInterface::class); foreach ($uriMapping as $originalUri => $newUri) { $existingRedirect = $redirectStorage->getOneBySourceUriPathAndHost($originalUri); if ($existingRedirect === null) { $redirectStorage->addRedirect($originalUri, $newUri, 301); } } } $this->getRepository($asset)->update($asset); $this->emitAssetResourceReplaced($asset); }
[ "public", "function", "replaceAssetResource", "(", "AssetInterface", "$", "asset", ",", "PersistentResource", "$", "resource", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "originalAssetResource", "=", "$", "asset", "->", "getResource", "(", ")"...
Replace resource on an asset. Takes variants and redirect handling into account. @param AssetInterface $asset @param PersistentResource $resource @param array $options @return void
[ "Replace", "resource", "on", "an", "asset", ".", "Takes", "variants", "and", "redirect", "handling", "into", "account", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Service/AssetService.php#L253-L308
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Module/Management/HistoryController.php
HistoryController.indexAction
public function indexAction($offset = 0, $limit = 10) { $events = $this->eventRepository->findRelevantEventsByWorkspace($offset, $limit + 1, 'live')->toArray(); $nextPage = null; if (count($events) > $limit) { $events = array_slice($events, 0, $limit); $nextPage = $this ->controllerContext ->getUriBuilder() ->setCreateAbsoluteUri(true) ->uriFor('Index', ['offset' => $offset + $limit], 'History', 'Neos.Neos'); } $eventsByDate = []; foreach ($events as $event) { /* @var $event Event */ $day = $event->getTimestamp()->format('Y-m-d'); if (!isset($eventsByDate[$day])) { $eventsByDate[$day] = new EventsOnDate($event->getTimestamp()); } /* @var $eventsOnThisDay EventsOnDate */ $eventsOnThisDay = $eventsByDate[$day]; $eventsOnThisDay->add($event); } $this->view->assignMultiple([ 'eventsByDate' => $eventsByDate, 'nextPage' => $nextPage ]); }
php
public function indexAction($offset = 0, $limit = 10) { $events = $this->eventRepository->findRelevantEventsByWorkspace($offset, $limit + 1, 'live')->toArray(); $nextPage = null; if (count($events) > $limit) { $events = array_slice($events, 0, $limit); $nextPage = $this ->controllerContext ->getUriBuilder() ->setCreateAbsoluteUri(true) ->uriFor('Index', ['offset' => $offset + $limit], 'History', 'Neos.Neos'); } $eventsByDate = []; foreach ($events as $event) { /* @var $event Event */ $day = $event->getTimestamp()->format('Y-m-d'); if (!isset($eventsByDate[$day])) { $eventsByDate[$day] = new EventsOnDate($event->getTimestamp()); } /* @var $eventsOnThisDay EventsOnDate */ $eventsOnThisDay = $eventsByDate[$day]; $eventsOnThisDay->add($event); } $this->view->assignMultiple([ 'eventsByDate' => $eventsByDate, 'nextPage' => $nextPage ]); }
[ "public", "function", "indexAction", "(", "$", "offset", "=", "0", ",", "$", "limit", "=", "10", ")", "{", "$", "events", "=", "$", "this", "->", "eventRepository", "->", "findRelevantEventsByWorkspace", "(", "$", "offset", ",", "$", "limit", "+", "1", ...
Show event overview. @param integer $offset @param integer $limit @return void
[ "Show", "event", "overview", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Module/Management/HistoryController.php#L44-L76
train
neos/neos-development-collection
Neos.Neos/Classes/Service/Controller/AbstractServiceController.php
AbstractServiceController.errorAction
public function errorAction() { if ($this->arguments->getValidationResults()->hasErrors()) { $errors = []; foreach ($this->arguments->getValidationResults()->getFlattenedErrors() as $propertyName => $propertyErrors) { foreach ($propertyErrors as $propertyError) { /** @var \Neos\Error\Messages\Error $propertyError */ $error = [ 'severity' => $propertyError->getSeverity(), 'message' => $propertyError->render() ]; if ($propertyError->getCode()) { $error['code'] = $propertyError->getCode(); } if ($propertyError->getTitle()) { $error['title'] = $propertyError->getTitle(); } $errors[$propertyName][] = $error; } } $this->throwStatus(409, null, json_encode($errors)); } $this->throwStatus(400); }
php
public function errorAction() { if ($this->arguments->getValidationResults()->hasErrors()) { $errors = []; foreach ($this->arguments->getValidationResults()->getFlattenedErrors() as $propertyName => $propertyErrors) { foreach ($propertyErrors as $propertyError) { /** @var \Neos\Error\Messages\Error $propertyError */ $error = [ 'severity' => $propertyError->getSeverity(), 'message' => $propertyError->render() ]; if ($propertyError->getCode()) { $error['code'] = $propertyError->getCode(); } if ($propertyError->getTitle()) { $error['title'] = $propertyError->getTitle(); } $errors[$propertyName][] = $error; } } $this->throwStatus(409, null, json_encode($errors)); } $this->throwStatus(400); }
[ "public", "function", "errorAction", "(", ")", "{", "if", "(", "$", "this", "->", "arguments", "->", "getValidationResults", "(", ")", "->", "hasErrors", "(", ")", ")", "{", "$", "errors", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "argum...
A preliminary error action for handling validation errors @return void
[ "A", "preliminary", "error", "action", "for", "handling", "validation", "errors" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/AbstractServiceController.php#L39-L62
train
neos/neos-development-collection
Neos.Neos/Classes/Routing/Aspects/RouteCacheAspect.php
RouteCacheAspect.addCurrentNodeIdentifier
public function addCurrentNodeIdentifier(JoinPointInterface $joinPoint) { $values = $joinPoint->getMethodArgument('values'); if (!isset($values['node']) || strpos($values['node'], '@') === false) { return; } // Build context explicitly without authorization checks because the security context isn't available yet // anyway and any Entity Privilege targeted on Workspace would fail at this point: $this->securityContext->withoutAuthorizationChecks(function () use ($joinPoint, $values) { $contextPathPieces = NodePaths::explodeContextPath($values['node']); $context = $this->contextFactory->create([ 'workspaceName' => $contextPathPieces['workspaceName'], 'dimensions' => $contextPathPieces['dimensions'], 'invisibleContentShown' => true ]); /** @var NodeInterface $node */ $node = $context->getNode($contextPathPieces['nodePath']); if (!$node instanceof NodeInterface) { return; } $values['node-identifier'] = $node->getIdentifier(); $values['node-parent-identifier'] = []; while ($node = $node->getParent()) { $values['node-parent-identifier'][] = $node->getIdentifier(); } $joinPoint->setMethodArgument('values', $values); }); }
php
public function addCurrentNodeIdentifier(JoinPointInterface $joinPoint) { $values = $joinPoint->getMethodArgument('values'); if (!isset($values['node']) || strpos($values['node'], '@') === false) { return; } // Build context explicitly without authorization checks because the security context isn't available yet // anyway and any Entity Privilege targeted on Workspace would fail at this point: $this->securityContext->withoutAuthorizationChecks(function () use ($joinPoint, $values) { $contextPathPieces = NodePaths::explodeContextPath($values['node']); $context = $this->contextFactory->create([ 'workspaceName' => $contextPathPieces['workspaceName'], 'dimensions' => $contextPathPieces['dimensions'], 'invisibleContentShown' => true ]); /** @var NodeInterface $node */ $node = $context->getNode($contextPathPieces['nodePath']); if (!$node instanceof NodeInterface) { return; } $values['node-identifier'] = $node->getIdentifier(); $values['node-parent-identifier'] = []; while ($node = $node->getParent()) { $values['node-parent-identifier'][] = $node->getIdentifier(); } $joinPoint->setMethodArgument('values', $values); }); }
[ "public", "function", "addCurrentNodeIdentifier", "(", "JoinPointInterface", "$", "joinPoint", ")", "{", "$", "values", "=", "$", "joinPoint", "->", "getMethodArgument", "(", "'values'", ")", ";", "if", "(", "!", "isset", "(", "$", "values", "[", "'node'", "...
Add the current node and all parent identifiers to be used for cache entry tagging @Flow\Before("method(Neos\Flow\Mvc\Routing\RouterCachingService->extractUuids())") @param JoinPointInterface $joinPoint The current join point @return void
[ "Add", "the", "current", "node", "and", "all", "parent", "identifiers", "to", "be", "used", "for", "cache", "entry", "tagging" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/Aspects/RouteCacheAspect.php#L47-L78
train
neos/neos-development-collection
Neos.Neos/Classes/Routing/Aspects/RouteCacheAspect.php
RouteCacheAspect.addWorkspaceName
public function addWorkspaceName(JoinPointInterface $joinPoint) { $tags = $joinPoint->getAdviceChain()->proceed($joinPoint); $values = $joinPoint->getMethodArgument('routeValues'); if (isset($values['node']) && strpos($values['node'], '@') !== false) { // Build context explicitly without authorization checks because the security context isn't available yet // anyway and any Entity Privilege targeted on Workspace would fail at this point: $this->securityContext->withoutAuthorizationChecks(function () use ($values, &$tags) { $contextPathPieces = NodePaths::explodeContextPath($values['node']); $tags[] = $contextPathPieces['workspaceName']; }); } return $tags; }
php
public function addWorkspaceName(JoinPointInterface $joinPoint) { $tags = $joinPoint->getAdviceChain()->proceed($joinPoint); $values = $joinPoint->getMethodArgument('routeValues'); if (isset($values['node']) && strpos($values['node'], '@') !== false) { // Build context explicitly without authorization checks because the security context isn't available yet // anyway and any Entity Privilege targeted on Workspace would fail at this point: $this->securityContext->withoutAuthorizationChecks(function () use ($values, &$tags) { $contextPathPieces = NodePaths::explodeContextPath($values['node']); $tags[] = $contextPathPieces['workspaceName']; }); } return $tags; }
[ "public", "function", "addWorkspaceName", "(", "JoinPointInterface", "$", "joinPoint", ")", "{", "$", "tags", "=", "$", "joinPoint", "->", "getAdviceChain", "(", ")", "->", "proceed", "(", "$", "joinPoint", ")", ";", "$", "values", "=", "$", "joinPoint", "...
Add the current workspace name as a tag for the route cache entry @Flow\Around("method(Neos\Flow\Mvc\Routing\RouterCachingService->generateRouteTags())") @param JoinPointInterface $joinPoint The current join point @return array
[ "Add", "the", "current", "workspace", "name", "as", "a", "tag", "for", "the", "route", "cache", "entry" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/Aspects/RouteCacheAspect.php#L87-L102
train
neos/neos-development-collection
Neos.Neos/Classes/Service/BackendRedirectionService.php
BackendRedirectionService.getAfterLoginRedirectionUri
public function getAfterLoginRedirectionUri(ActionRequest $actionRequest) { $user = $this->userService->getBackendUser(); if ($user === null) { return null; } $workspaceName = $this->userService->getPersonalWorkspaceName(); $this->createWorkspaceAndRootNodeIfNecessary($workspaceName); $uriBuilder = new UriBuilder(); $uriBuilder->setRequest($actionRequest); $uriBuilder->setFormat('html'); $uriBuilder->setCreateAbsoluteUri(true); $nodeToEdit = $this->getLastVisitedNode($workspaceName); if ($nodeToEdit === null) { $contentContext = $this->createContext($workspaceName); $nodeToEdit = $contentContext->getCurrentSiteNode(); } $arguments = array_merge(['node' => $nodeToEdit], $this->routingValuesAfterLogin); return $uriBuilder->uriFor($this->routingValuesAfterLogin['@action'], $arguments, $this->routingValuesAfterLogin['@controller'], $this->routingValuesAfterLogin['@package']); }
php
public function getAfterLoginRedirectionUri(ActionRequest $actionRequest) { $user = $this->userService->getBackendUser(); if ($user === null) { return null; } $workspaceName = $this->userService->getPersonalWorkspaceName(); $this->createWorkspaceAndRootNodeIfNecessary($workspaceName); $uriBuilder = new UriBuilder(); $uriBuilder->setRequest($actionRequest); $uriBuilder->setFormat('html'); $uriBuilder->setCreateAbsoluteUri(true); $nodeToEdit = $this->getLastVisitedNode($workspaceName); if ($nodeToEdit === null) { $contentContext = $this->createContext($workspaceName); $nodeToEdit = $contentContext->getCurrentSiteNode(); } $arguments = array_merge(['node' => $nodeToEdit], $this->routingValuesAfterLogin); return $uriBuilder->uriFor($this->routingValuesAfterLogin['@action'], $arguments, $this->routingValuesAfterLogin['@controller'], $this->routingValuesAfterLogin['@package']); }
[ "public", "function", "getAfterLoginRedirectionUri", "(", "ActionRequest", "$", "actionRequest", ")", "{", "$", "user", "=", "$", "this", "->", "userService", "->", "getBackendUser", "(", ")", ";", "if", "(", "$", "user", "===", "null", ")", "{", "return", ...
Returns a specific URI string to redirect to after the login; or NULL if there is none. @param ActionRequest $actionRequest @return string
[ "Returns", "a", "specific", "URI", "string", "to", "redirect", "to", "after", "the", "login", ";", "or", "NULL", "if", "there", "is", "none", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/BackendRedirectionService.php#L101-L124
train
neos/neos-development-collection
Neos.Neos/Classes/Service/BackendRedirectionService.php
BackendRedirectionService.getAfterLogoutRedirectionUri
public function getAfterLogoutRedirectionUri(ActionRequest $actionRequest) { $lastVisitedNode = $this->getLastVisitedNode('live'); if ($lastVisitedNode === null) { return null; } $uriBuilder = new UriBuilder(); $uriBuilder->setRequest($actionRequest); $uriBuilder->setFormat('html'); $uriBuilder->setCreateAbsoluteUri(true); return $uriBuilder->uriFor('show', ['node' => $lastVisitedNode], 'Frontend\\Node', 'Neos.Neos'); }
php
public function getAfterLogoutRedirectionUri(ActionRequest $actionRequest) { $lastVisitedNode = $this->getLastVisitedNode('live'); if ($lastVisitedNode === null) { return null; } $uriBuilder = new UriBuilder(); $uriBuilder->setRequest($actionRequest); $uriBuilder->setFormat('html'); $uriBuilder->setCreateAbsoluteUri(true); return $uriBuilder->uriFor('show', ['node' => $lastVisitedNode], 'Frontend\\Node', 'Neos.Neos'); }
[ "public", "function", "getAfterLogoutRedirectionUri", "(", "ActionRequest", "$", "actionRequest", ")", "{", "$", "lastVisitedNode", "=", "$", "this", "->", "getLastVisitedNode", "(", "'live'", ")", ";", "if", "(", "$", "lastVisitedNode", "===", "null", ")", "{",...
Returns a specific URI string to redirect to after the logout; or NULL if there is none. In case of NULL, it's the responsibility of the AuthenticationController where to redirect, most likely to the LoginController's index action. @param ActionRequest $actionRequest @return string A possible redirection URI, if any
[ "Returns", "a", "specific", "URI", "string", "to", "redirect", "to", "after", "the", "logout", ";", "or", "NULL", "if", "there", "is", "none", ".", "In", "case", "of", "NULL", "it", "s", "the", "responsibility", "of", "the", "AuthenticationController", "wh...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/BackendRedirectionService.php#L134-L145
train
neos/neos-development-collection
Neos.Neos/Classes/Service/BackendRedirectionService.php
BackendRedirectionService.createWorkspaceAndRootNodeIfNecessary
protected function createWorkspaceAndRootNodeIfNecessary($workspaceName) { $workspace = $this->workspaceRepository->findOneByName($workspaceName); if ($workspace === null) { $liveWorkspace = $this->workspaceRepository->findOneByName('live'); $owner = $this->userService->getBackendUser(); $workspace = new Workspace($workspaceName, $liveWorkspace, $owner); $this->workspaceRepository->add($workspace); $this->persistenceManager->whitelistObject($workspace); } $contentContext = $this->createContext($workspaceName); $rootNode = $contentContext->getRootNode(); $this->persistenceManager->whitelistObject($rootNode); $this->persistenceManager->whitelistObject($rootNode->getNodeData()); $this->persistenceManager->persistAll(true); }
php
protected function createWorkspaceAndRootNodeIfNecessary($workspaceName) { $workspace = $this->workspaceRepository->findOneByName($workspaceName); if ($workspace === null) { $liveWorkspace = $this->workspaceRepository->findOneByName('live'); $owner = $this->userService->getBackendUser(); $workspace = new Workspace($workspaceName, $liveWorkspace, $owner); $this->workspaceRepository->add($workspace); $this->persistenceManager->whitelistObject($workspace); } $contentContext = $this->createContext($workspaceName); $rootNode = $contentContext->getRootNode(); $this->persistenceManager->whitelistObject($rootNode); $this->persistenceManager->whitelistObject($rootNode->getNodeData()); $this->persistenceManager->persistAll(true); }
[ "protected", "function", "createWorkspaceAndRootNodeIfNecessary", "(", "$", "workspaceName", ")", "{", "$", "workspace", "=", "$", "this", "->", "workspaceRepository", "->", "findOneByName", "(", "$", "workspaceName", ")", ";", "if", "(", "$", "workspace", "===", ...
If the specified workspace or its root node does not exist yet, the workspace and root node will be created. This method is basically a safeguard for legacy and potentially broken websites where users might not have their own workspace yet. In a normal setup, the Domain User Service is responsible for creating and deleting user workspaces. @param string $workspaceName Name of the workspace @return void
[ "If", "the", "specified", "workspace", "or", "its", "root", "node", "does", "not", "exist", "yet", "the", "workspace", "and", "root", "node", "will", "be", "created", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/BackendRedirectionService.php#L194-L210
train
neos/neos-development-collection
Neos.Media/Classes/TypeConverter/ImageInterfaceJsonSerializer.php
ImageInterfaceJsonSerializer.convertFrom
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) { $data = parent::convertFrom($source, 'array', $convertedChildProperties, $configuration); return json_encode($data); }
php
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) { $data = parent::convertFrom($source, 'array', $convertedChildProperties, $configuration); return json_encode($data); }
[ "public", "function", "convertFrom", "(", "$", "source", ",", "$", "targetType", ",", "array", "$", "convertedChildProperties", "=", "[", "]", ",", "PropertyMappingConfigurationInterface", "$", "configuration", "=", "null", ")", "{", "$", "data", "=", "parent", ...
Convert an object from \Neos\Media\Domain\Model\ImageInterface to a json representation. @param ImageInterface $source @param string $targetType must be 'string' @param array $convertedChildProperties @param PropertyMappingConfigurationInterface $configuration @return string The converted ImageInterface
[ "Convert", "an", "object", "from", "\\", "Neos", "\\", "Media", "\\", "Domain", "\\", "Model", "\\", "ImageInterface", "to", "a", "json", "representation", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/TypeConverter/ImageInterfaceJsonSerializer.php#L45-L49
train
neos/neos-development-collection
Neos.Neos/Classes/Fusion/Helper/NodeHelper.php
NodeHelper.nearestContentCollection
public function nearestContentCollection(NodeInterface $node, $nodePath) { $contentCollectionType = 'Neos.Neos:ContentCollection'; if ($node->getNodeType()->isOfType($contentCollectionType)) { return $node; } else { if ((string)$nodePath === '') { throw new Exception(sprintf('No content collection of type %s could be found in the current node and no node path was provided. You might want to configure the nodePath property with a relative path to the content collection.', $contentCollectionType), 1409300545); } $subNode = $node->getNode($nodePath); if ($subNode !== null && $subNode->getNodeType()->isOfType($contentCollectionType)) { return $subNode; } else { throw new Exception(sprintf('No content collection of type %s could be found in the current node (%s) or at the path "%s". You might want to adjust your node type configuration and create the missing child node through the "flow node:repair --node-type %s" command.', $contentCollectionType, $node->getPath(), $nodePath, (string)$node->getNodeType()), 1389352984); } } }
php
public function nearestContentCollection(NodeInterface $node, $nodePath) { $contentCollectionType = 'Neos.Neos:ContentCollection'; if ($node->getNodeType()->isOfType($contentCollectionType)) { return $node; } else { if ((string)$nodePath === '') { throw new Exception(sprintf('No content collection of type %s could be found in the current node and no node path was provided. You might want to configure the nodePath property with a relative path to the content collection.', $contentCollectionType), 1409300545); } $subNode = $node->getNode($nodePath); if ($subNode !== null && $subNode->getNodeType()->isOfType($contentCollectionType)) { return $subNode; } else { throw new Exception(sprintf('No content collection of type %s could be found in the current node (%s) or at the path "%s". You might want to adjust your node type configuration and create the missing child node through the "flow node:repair --node-type %s" command.', $contentCollectionType, $node->getPath(), $nodePath, (string)$node->getNodeType()), 1389352984); } } }
[ "public", "function", "nearestContentCollection", "(", "NodeInterface", "$", "node", ",", "$", "nodePath", ")", "{", "$", "contentCollectionType", "=", "'Neos.Neos:ContentCollection'", ";", "if", "(", "$", "node", "->", "getNodeType", "(", ")", "->", "isOfType", ...
Check if the given node is already a collection, find collection by nodePath otherwise, throw exception if no content collection could be found @param NodeInterface $node @param string $nodePath @return NodeInterface @throws Exception
[ "Check", "if", "the", "given", "node", "is", "already", "a", "collection", "find", "collection", "by", "nodePath", "otherwise", "throw", "exception", "if", "no", "content", "collection", "could", "be", "found" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php#L33-L49
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Utility/NodePaths.php
NodePaths.getParentPath
public static function getParentPath($path) { if ($path === '/') { $parentPath = ''; } elseif (strrpos($path, '/') === 0) { $parentPath = '/'; } else { $parentPath = substr($path, 0, strrpos($path, '/')); } return $parentPath; }
php
public static function getParentPath($path) { if ($path === '/') { $parentPath = ''; } elseif (strrpos($path, '/') === 0) { $parentPath = '/'; } else { $parentPath = substr($path, 0, strrpos($path, '/')); } return $parentPath; }
[ "public", "static", "function", "getParentPath", "(", "$", "path", ")", "{", "if", "(", "$", "path", "===", "'/'", ")", "{", "$", "parentPath", "=", "''", ";", "}", "elseif", "(", "strrpos", "(", "$", "path", ",", "'/'", ")", "===", "0", ")", "{"...
Get the parent path of the given Node path. @param string $path @return string
[ "Get", "the", "parent", "path", "of", "the", "given", "Node", "path", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Utility/NodePaths.php#L131-L142
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.invokeSubCommand
public function invokeSubCommand($controllerCommandName, ConsoleOutput $output, NodeType $nodeType = null, $workspaceName = 'live', $dryRun = false, $cleanup = true, $skip = null, $only = null) { /** @noinspection PhpDeprecationInspection This is only set for backwards compatibility */ $this->output = $output; $commandMethods = [ 'removeAbstractAndUndefinedNodes' => [ 'cleanup' => true ], 'removeOrphanNodes' => [ 'cleanup' => true ], 'removeDisallowedChildNodes' => [ 'cleanup' => true ], 'removeUndefinedProperties' => [ 'cleanup' => true ], 'removeBrokenEntityReferences' => [ 'cleanup' => true ], 'removeNodesWithInvalidDimensions' => [ 'cleanup' => true ], 'removeNodesWithInvalidWorkspace' => [ 'cleanup' => true ], 'fixNodesWithInconsistentIdentifier' => [ 'cleanup' => false ], 'createMissingChildNodes' => [ 'cleanup' => false ], 'reorderChildNodes' => [ 'cleanup' => false ], 'addMissingDefaultValues' => [ 'cleanup' => false ], 'repairShadowNodes' => [ 'cleanup' => false ] ]; $skipCommandNames = Arrays::trimExplode(',', ($skip === null ? '' : $skip)); $onlyCommandNames = Arrays::trimExplode(',', ($only === null ? '' : $only)); switch ($controllerCommandName) { case 'repair': foreach ($commandMethods as $commandMethodName => $commandMethodConfiguration) { if (in_array($commandMethodName, $skipCommandNames)) { continue; } if ($onlyCommandNames !== [] && !in_array($commandMethodName, $onlyCommandNames)) { continue; } if (!$cleanup && $commandMethodConfiguration['cleanup']) { continue; } $this->$commandMethodName($workspaceName, $dryRun, $nodeType); } } }
php
public function invokeSubCommand($controllerCommandName, ConsoleOutput $output, NodeType $nodeType = null, $workspaceName = 'live', $dryRun = false, $cleanup = true, $skip = null, $only = null) { /** @noinspection PhpDeprecationInspection This is only set for backwards compatibility */ $this->output = $output; $commandMethods = [ 'removeAbstractAndUndefinedNodes' => [ 'cleanup' => true ], 'removeOrphanNodes' => [ 'cleanup' => true ], 'removeDisallowedChildNodes' => [ 'cleanup' => true ], 'removeUndefinedProperties' => [ 'cleanup' => true ], 'removeBrokenEntityReferences' => [ 'cleanup' => true ], 'removeNodesWithInvalidDimensions' => [ 'cleanup' => true ], 'removeNodesWithInvalidWorkspace' => [ 'cleanup' => true ], 'fixNodesWithInconsistentIdentifier' => [ 'cleanup' => false ], 'createMissingChildNodes' => [ 'cleanup' => false ], 'reorderChildNodes' => [ 'cleanup' => false ], 'addMissingDefaultValues' => [ 'cleanup' => false ], 'repairShadowNodes' => [ 'cleanup' => false ] ]; $skipCommandNames = Arrays::trimExplode(',', ($skip === null ? '' : $skip)); $onlyCommandNames = Arrays::trimExplode(',', ($only === null ? '' : $only)); switch ($controllerCommandName) { case 'repair': foreach ($commandMethods as $commandMethodName => $commandMethodConfiguration) { if (in_array($commandMethodName, $skipCommandNames)) { continue; } if ($onlyCommandNames !== [] && !in_array($commandMethodName, $onlyCommandNames)) { continue; } if (!$cleanup && $commandMethodConfiguration['cleanup']) { continue; } $this->$commandMethodName($workspaceName, $dryRun, $nodeType); } } }
[ "public", "function", "invokeSubCommand", "(", "$", "controllerCommandName", ",", "ConsoleOutput", "$", "output", ",", "NodeType", "$", "nodeType", "=", "null", ",", "$", "workspaceName", "=", "'live'", ",", "$", "dryRun", "=", "false", ",", "$", "cleanup", ...
A method which runs the task implemented by the plugin for the given command @param string $controllerCommandName Name of the command in question, for example "repair" @param ConsoleOutput $output (unused) @param NodeType $nodeType Only handle this node type (if specified) @param string $workspaceName Only handle this workspace (if specified) @param boolean $dryRun If true, don't do any changes, just simulate what you would do @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
[ "A", "method", "which", "runs", "the", "task", "implemented", "by", "the", "plugin", "for", "the", "given", "command" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L242-L278
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.createMissingChildNodes
protected function createMissingChildNodes($workspaceName, $dryRun, NodeType $nodeType = null) { if ($nodeType !== null) { $this->dispatch(self::EVENT_NOTICE, sprintf('Checking nodes of type "<i>%s</i>" for missing child nodes ...', $nodeType->getName())); $this->createChildNodesByNodeType($nodeType, $workspaceName, $dryRun); } else { $this->dispatch(self::EVENT_NOTICE, 'Checking for missing child nodes ...'); foreach ($this->nodeTypeManager->getNodeTypes() as $nodeType) { /** @var NodeType $nodeType */ if ($nodeType->isAbstract()) { continue; } $this->createChildNodesByNodeType($nodeType, $workspaceName, $dryRun); } } $this->persistenceManager->persistAll(); }
php
protected function createMissingChildNodes($workspaceName, $dryRun, NodeType $nodeType = null) { if ($nodeType !== null) { $this->dispatch(self::EVENT_NOTICE, sprintf('Checking nodes of type "<i>%s</i>" for missing child nodes ...', $nodeType->getName())); $this->createChildNodesByNodeType($nodeType, $workspaceName, $dryRun); } else { $this->dispatch(self::EVENT_NOTICE, 'Checking for missing child nodes ...'); foreach ($this->nodeTypeManager->getNodeTypes() as $nodeType) { /** @var NodeType $nodeType */ if ($nodeType->isAbstract()) { continue; } $this->createChildNodesByNodeType($nodeType, $workspaceName, $dryRun); } } $this->persistenceManager->persistAll(); }
[ "protected", "function", "createMissingChildNodes", "(", "$", "workspaceName", ",", "$", "dryRun", ",", "NodeType", "$", "nodeType", "=", "null", ")", "{", "if", "(", "$", "nodeType", "!==", "null", ")", "{", "$", "this", "->", "dispatch", "(", "self", "...
Performs checks for missing child nodes according to the node's auto-create configuration and creates them if necessary. @param string $workspaceName Name of the workspace to consider @param boolean $dryRun Simulate? @param NodeType $nodeType Only for this node type, if specified @return void @throws NodeConfigurationException @throws NodeTypeNotFoundException
[ "Performs", "checks", "for", "missing", "child", "nodes", "according", "to", "the", "node", "s", "auto", "-", "create", "configuration", "and", "creates", "them", "if", "necessary", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L291-L308
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.addMissingDefaultValues
public function addMissingDefaultValues($workspaceName, $dryRun, NodeType $nodeType = null) { if ($nodeType !== null) { $this->dispatch(self::EVENT_NOTICE, sprintf('Checking nodes of type <i>%s</i> for missing default values ...', $nodeType)); $this->addMissingDefaultValuesByNodeType($nodeType, $workspaceName, $dryRun); } else { $this->dispatch(self::EVENT_NOTICE, 'Checking for missing default values ...'); foreach ($this->nodeTypeManager->getNodeTypes() as $nodeType) { /** @var NodeType $nodeType */ if ($nodeType->isAbstract()) { continue; } $this->addMissingDefaultValuesByNodeType($nodeType, $workspaceName, $dryRun); } } }
php
public function addMissingDefaultValues($workspaceName, $dryRun, NodeType $nodeType = null) { if ($nodeType !== null) { $this->dispatch(self::EVENT_NOTICE, sprintf('Checking nodes of type <i>%s</i> for missing default values ...', $nodeType)); $this->addMissingDefaultValuesByNodeType($nodeType, $workspaceName, $dryRun); } else { $this->dispatch(self::EVENT_NOTICE, 'Checking for missing default values ...'); foreach ($this->nodeTypeManager->getNodeTypes() as $nodeType) { /** @var NodeType $nodeType */ if ($nodeType->isAbstract()) { continue; } $this->addMissingDefaultValuesByNodeType($nodeType, $workspaceName, $dryRun); } } }
[ "public", "function", "addMissingDefaultValues", "(", "$", "workspaceName", ",", "$", "dryRun", ",", "NodeType", "$", "nodeType", "=", "null", ")", "{", "if", "(", "$", "nodeType", "!==", "null", ")", "{", "$", "this", "->", "dispatch", "(", "self", "::"...
Performs checks for unset properties that has default values and sets them if necessary. @param string $workspaceName Name of the workspace to consider @param boolean $dryRun Simulate? @param NodeType $nodeType Only for this node type, if specified @return void @throws NodeConfigurationException @throws NodeTypeNotFoundException
[ "Performs", "checks", "for", "unset", "properties", "that", "has", "default", "values", "and", "sets", "them", "if", "necessary", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L440-L455
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.removeAbstractAndUndefinedNodes
protected function removeAbstractAndUndefinedNodes($workspaceName) { $this->dispatch(self::EVENT_NOTICE, 'Checking for nodes with abstract or undefined node types ...'); $abstractNodeTypes = []; $nonAbstractNodeTypes = []; foreach ($this->nodeTypeManager->getNodeTypes() as $nodeType) { /** @var NodeType $nodeType */ if ($nodeType->isAbstract()) { $abstractNodeTypes[] = $nodeType->getName(); } else { $nonAbstractNodeTypes[] = $nodeType->getName(); } } /** @var \Doctrine\ORM\QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder ->select('n') ->distinct() ->from(NodeData::class, 'n') ->where('n.nodeType NOT IN (:excludeNodeTypes)') ->setParameter('excludeNodeTypes', $nonAbstractNodeTypes) ->andWhere('n.workspace = :workspace') ->setParameter('workspace', $workspaceName); $nodes = $queryBuilder->getQuery()->getArrayResult(); $removableNodesCount = count($nodes); if ($removableNodesCount === 0) { return; } foreach ($nodes as $node) { $name = $node['path'] === '/' ? '' : substr($node['path'], strrpos($node['path'], '/') + 1); $type = in_array($node['nodeType'], $abstractNodeTypes) ? 'abstract' : 'undefined'; $this->dispatch(self::EVENT_NOTICE, sprintf('Found node with %s node type named "<i>%s</i>" (<i>%s</i>) in "<i>%s</i>"', $type, $name, $node['nodeType'], $node['path'])); } $taskDescription = sprintf('Remove <i>%d</i> node%s with abstract or undefined node types', $removableNodesCount, $removableNodesCount > 1 ? 's' : ''); $taskClosure = function () use ($nodes) { foreach ($nodes as $node) { $this->removeNode($node['identifier'], $node['dimensionsHash']); } }; $taskRequiresConfirmation = true; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure, $taskRequiresConfirmation); }
php
protected function removeAbstractAndUndefinedNodes($workspaceName) { $this->dispatch(self::EVENT_NOTICE, 'Checking for nodes with abstract or undefined node types ...'); $abstractNodeTypes = []; $nonAbstractNodeTypes = []; foreach ($this->nodeTypeManager->getNodeTypes() as $nodeType) { /** @var NodeType $nodeType */ if ($nodeType->isAbstract()) { $abstractNodeTypes[] = $nodeType->getName(); } else { $nonAbstractNodeTypes[] = $nodeType->getName(); } } /** @var \Doctrine\ORM\QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder ->select('n') ->distinct() ->from(NodeData::class, 'n') ->where('n.nodeType NOT IN (:excludeNodeTypes)') ->setParameter('excludeNodeTypes', $nonAbstractNodeTypes) ->andWhere('n.workspace = :workspace') ->setParameter('workspace', $workspaceName); $nodes = $queryBuilder->getQuery()->getArrayResult(); $removableNodesCount = count($nodes); if ($removableNodesCount === 0) { return; } foreach ($nodes as $node) { $name = $node['path'] === '/' ? '' : substr($node['path'], strrpos($node['path'], '/') + 1); $type = in_array($node['nodeType'], $abstractNodeTypes) ? 'abstract' : 'undefined'; $this->dispatch(self::EVENT_NOTICE, sprintf('Found node with %s node type named "<i>%s</i>" (<i>%s</i>) in "<i>%s</i>"', $type, $name, $node['nodeType'], $node['path'])); } $taskDescription = sprintf('Remove <i>%d</i> node%s with abstract or undefined node types', $removableNodesCount, $removableNodesCount > 1 ? 's' : ''); $taskClosure = function () use ($nodes) { foreach ($nodes as $node) { $this->removeNode($node['identifier'], $node['dimensionsHash']); } }; $taskRequiresConfirmation = true; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure, $taskRequiresConfirmation); }
[ "protected", "function", "removeAbstractAndUndefinedNodes", "(", "$", "workspaceName", ")", "{", "$", "this", "->", "dispatch", "(", "self", "::", "EVENT_NOTICE", ",", "'Checking for nodes with abstract or undefined node types ...'", ")", ";", "$", "abstractNodeTypes", "=...
Performs checks for nodes with abstract or undefined node types and removes them if found. @param string $workspaceName @return void
[ "Performs", "checks", "for", "nodes", "with", "abstract", "or", "undefined", "node", "types", "and", "removes", "them", "if", "found", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L532-L579
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.removeDisallowedChildNodes
protected function removeDisallowedChildNodes($workspaceName) { $this->dispatch(self::EVENT_NOTICE, 'Checking for disallowed child nodes ...'); /** @var \Neos\ContentRepository\Domain\Model\Workspace $workspace */ $workspace = $this->workspaceRepository->findByIdentifier($workspaceName); $nodes = []; $nodeExceptionCount = 0; $removeDisallowedChildNodes = function (NodeInterface $node) use (&$removeDisallowedChildNodes, &$nodes, &$nodeExceptionCount) { try { foreach ($node->getChildNodes() as $childNode) { /** @var $childNode NodeInterface */ if (!$childNode->isAutoCreated() && !$node->isNodeTypeAllowedAsChildNode($childNode->getNodeType())) { $nodes[] = $childNode; $parent = $node->isAutoCreated() ? $node->getParent() : $node; $this->dispatch(self::EVENT_NOTICE, sprintf('Found disallowed node named "<i>%s</i>" (<i>%s</i>) in "<i>%s</i>", child of node "<i>%s</i>" (<i>%s</i>)', $childNode->getName(), $childNode->getNodeType()->getName(), $childNode->getPath(), $parent->getName(), $parent->getNodeType()->getName())); } else { $removeDisallowedChildNodes($childNode); } } } catch (\Exception $exception) { $this->dispatch(self::EVENT_WARNING, sprintf('Error while traversing child nodes of node <i>%s</i>: %s (%s)', $node->getIdentifier(), $exception->getMessage(), $exception->getCode())); $nodeExceptionCount++; } }; // TODO: Performance could be improved by a search for all child node data instead of looping over all contexts foreach ($this->contentDimensionCombinator->getAllAllowedCombinations() as $dimensionConfiguration) { $context = $this->createContext($workspace->getName(), $dimensionConfiguration); $removeDisallowedChildNodes($context->getRootNode()); $context->getFirstLevelNodeCache()->flush(); $this->nodeFactory->reset(); } $disallowedChildNodesCount = count($nodes); if ($disallowedChildNodesCount > 0) { $taskDescription = sprintf('Remove <i>%d</i> disallowed node%s.', $disallowedChildNodesCount, $disallowedChildNodesCount > 1 ? 's' : ''); $taskClosure = function () use ($nodes, $workspaceName) { foreach ($nodes as $node) { $this->removeNodeAndChildNodesInWorkspaceByPath($node->getPath(), $workspaceName); } }; $taskRequiresConfirmation = true; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure, $taskRequiresConfirmation); if ($nodeExceptionCount > 0) { $this->dispatch(self::EVENT_NOTICE, '<i>%d</i> error%s occurred during child node traversing.', $nodeExceptionCount, $nodeExceptionCount > 1 ? 's' : ''); } } }
php
protected function removeDisallowedChildNodes($workspaceName) { $this->dispatch(self::EVENT_NOTICE, 'Checking for disallowed child nodes ...'); /** @var \Neos\ContentRepository\Domain\Model\Workspace $workspace */ $workspace = $this->workspaceRepository->findByIdentifier($workspaceName); $nodes = []; $nodeExceptionCount = 0; $removeDisallowedChildNodes = function (NodeInterface $node) use (&$removeDisallowedChildNodes, &$nodes, &$nodeExceptionCount) { try { foreach ($node->getChildNodes() as $childNode) { /** @var $childNode NodeInterface */ if (!$childNode->isAutoCreated() && !$node->isNodeTypeAllowedAsChildNode($childNode->getNodeType())) { $nodes[] = $childNode; $parent = $node->isAutoCreated() ? $node->getParent() : $node; $this->dispatch(self::EVENT_NOTICE, sprintf('Found disallowed node named "<i>%s</i>" (<i>%s</i>) in "<i>%s</i>", child of node "<i>%s</i>" (<i>%s</i>)', $childNode->getName(), $childNode->getNodeType()->getName(), $childNode->getPath(), $parent->getName(), $parent->getNodeType()->getName())); } else { $removeDisallowedChildNodes($childNode); } } } catch (\Exception $exception) { $this->dispatch(self::EVENT_WARNING, sprintf('Error while traversing child nodes of node <i>%s</i>: %s (%s)', $node->getIdentifier(), $exception->getMessage(), $exception->getCode())); $nodeExceptionCount++; } }; // TODO: Performance could be improved by a search for all child node data instead of looping over all contexts foreach ($this->contentDimensionCombinator->getAllAllowedCombinations() as $dimensionConfiguration) { $context = $this->createContext($workspace->getName(), $dimensionConfiguration); $removeDisallowedChildNodes($context->getRootNode()); $context->getFirstLevelNodeCache()->flush(); $this->nodeFactory->reset(); } $disallowedChildNodesCount = count($nodes); if ($disallowedChildNodesCount > 0) { $taskDescription = sprintf('Remove <i>%d</i> disallowed node%s.', $disallowedChildNodesCount, $disallowedChildNodesCount > 1 ? 's' : ''); $taskClosure = function () use ($nodes, $workspaceName) { foreach ($nodes as $node) { $this->removeNodeAndChildNodesInWorkspaceByPath($node->getPath(), $workspaceName); } }; $taskRequiresConfirmation = true; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure, $taskRequiresConfirmation); if ($nodeExceptionCount > 0) { $this->dispatch(self::EVENT_NOTICE, '<i>%d</i> error%s occurred during child node traversing.', $nodeExceptionCount, $nodeExceptionCount > 1 ? 's' : ''); } } }
[ "protected", "function", "removeDisallowedChildNodes", "(", "$", "workspaceName", ")", "{", "$", "this", "->", "dispatch", "(", "self", "::", "EVENT_NOTICE", ",", "'Checking for disallowed child nodes ...'", ")", ";", "/** @var \\Neos\\ContentRepository\\Domain\\Model\\Worksp...
Performs checks for disallowed child nodes according to the node's auto-create configuration and constraints and removes them if found. @param string $workspaceName @return void
[ "Performs", "checks", "for", "disallowed", "child", "nodes", "according", "to", "the", "node", "s", "auto", "-", "create", "configuration", "and", "constraints", "and", "removes", "them", "if", "found", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L588-L638
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.getNodeDataByNodeTypeAndWorkspace
protected function getNodeDataByNodeTypeAndWorkspace($nodeType, $workspaceName) { /** @var QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder->select('n') ->distinct() ->from(NodeData::class, 'n') ->where('n.nodeType = :nodeType') ->andWhere('n.workspace = :workspace') ->andWhere('n.movedTo IS NULL OR n.removed = :removed') ->setParameter('nodeType', $nodeType) ->setParameter('workspace', $workspaceName) ->setParameter('removed', false, \PDO::PARAM_BOOL); return $queryBuilder->getQuery()->getResult(); }
php
protected function getNodeDataByNodeTypeAndWorkspace($nodeType, $workspaceName) { /** @var QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder->select('n') ->distinct() ->from(NodeData::class, 'n') ->where('n.nodeType = :nodeType') ->andWhere('n.workspace = :workspace') ->andWhere('n.movedTo IS NULL OR n.removed = :removed') ->setParameter('nodeType', $nodeType) ->setParameter('workspace', $workspaceName) ->setParameter('removed', false, \PDO::PARAM_BOOL); return $queryBuilder->getQuery()->getResult(); }
[ "protected", "function", "getNodeDataByNodeTypeAndWorkspace", "(", "$", "nodeType", ",", "$", "workspaceName", ")", "{", "/** @var QueryBuilder $queryBuilder */", "$", "queryBuilder", "=", "$", "this", "->", "entityManager", "->", "createQueryBuilder", "(", ")", ";", ...
Retrieves all NodeData objects of a certain node type inside a given workspace. Shadow nodes are excluded, because they will be published when publishing the moved node. @param string $nodeType @param string $workspaceName @return array<NodeData>
[ "Retrieves", "all", "NodeData", "objects", "of", "a", "certain", "node", "type", "inside", "a", "given", "workspace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L888-L903
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.removeNodeAndChildNodesInWorkspaceByPath
protected function removeNodeAndChildNodesInWorkspaceByPath($nodePath, $workspaceName) { /** @var QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder ->resetDQLParts() ->delete(NodeData::class, 'n') ->where('n.path LIKE :path') ->orWhere('n.path LIKE :subpath') ->andWhere('n.workspace = :workspace') ->setParameters(['path' => $nodePath, 'subpath' => $nodePath . '/%', 'workspace' => $workspaceName]) ->getQuery() ->execute(); }
php
protected function removeNodeAndChildNodesInWorkspaceByPath($nodePath, $workspaceName) { /** @var QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder ->resetDQLParts() ->delete(NodeData::class, 'n') ->where('n.path LIKE :path') ->orWhere('n.path LIKE :subpath') ->andWhere('n.workspace = :workspace') ->setParameters(['path' => $nodePath, 'subpath' => $nodePath . '/%', 'workspace' => $workspaceName]) ->getQuery() ->execute(); }
[ "protected", "function", "removeNodeAndChildNodesInWorkspaceByPath", "(", "$", "nodePath", ",", "$", "workspaceName", ")", "{", "/** @var QueryBuilder $queryBuilder */", "$", "queryBuilder", "=", "$", "this", "->", "entityManager", "->", "createQueryBuilder", "(", ")", ...
Removes all nodes with a specific path and their children in the given workspace. @param string $nodePath @param string $workspaceName
[ "Removes", "all", "nodes", "with", "a", "specific", "path", "and", "their", "children", "in", "the", "given", "workspace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L911-L925
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.removeNodesWithInvalidDimensions
public function removeNodesWithInvalidDimensions($workspaceName) { $this->dispatch(self::EVENT_NOTICE, 'Checking for nodes with invalid dimensions ...'); $allowedDimensionCombinations = $this->contentDimensionCombinator->getAllAllowedCombinations(); $nodesArray = $this->collectNodesWithInvalidDimensions($workspaceName, $allowedDimensionCombinations); if ($nodesArray === []) { return; } $numberOfNodes = count($nodesArray); $taskDescription = sprintf('Remove <i>%d</i> node%s with invalid dimension values', $numberOfNodes, $numberOfNodes > 1 ? 's' : ''); $taskClosure = function () use ($nodesArray) { foreach ($nodesArray as $nodeArray) { $this->removeNode($nodeArray['identifier'], $nodeArray['dimensionsHash']); } }; $taskRequiresConfirmation = true; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure, $taskRequiresConfirmation); }
php
public function removeNodesWithInvalidDimensions($workspaceName) { $this->dispatch(self::EVENT_NOTICE, 'Checking for nodes with invalid dimensions ...'); $allowedDimensionCombinations = $this->contentDimensionCombinator->getAllAllowedCombinations(); $nodesArray = $this->collectNodesWithInvalidDimensions($workspaceName, $allowedDimensionCombinations); if ($nodesArray === []) { return; } $numberOfNodes = count($nodesArray); $taskDescription = sprintf('Remove <i>%d</i> node%s with invalid dimension values', $numberOfNodes, $numberOfNodes > 1 ? 's' : ''); $taskClosure = function () use ($nodesArray) { foreach ($nodesArray as $nodeArray) { $this->removeNode($nodeArray['identifier'], $nodeArray['dimensionsHash']); } }; $taskRequiresConfirmation = true; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure, $taskRequiresConfirmation); }
[ "public", "function", "removeNodesWithInvalidDimensions", "(", "$", "workspaceName", ")", "{", "$", "this", "->", "dispatch", "(", "self", "::", "EVENT_NOTICE", ",", "'Checking for nodes with invalid dimensions ...'", ")", ";", "$", "allowedDimensionCombinations", "=", ...
Remove nodes with invalid dimension values This removes nodes which have dimension values not fitting to the current dimension configuration @param string $workspaceName Name of the workspace to consider @return void
[ "Remove", "nodes", "with", "invalid", "dimension", "values" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L956-L974
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.collectNodesWithInvalidDimensions
protected function collectNodesWithInvalidDimensions($workspaceName, array $allowedDimensionCombinations) { $nodes = []; ksort($allowedDimensionCombinations); /** @var QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder->select('n') ->from(NodeData::class, 'n') ->where('n.workspace = :workspace') ->setParameter('workspace', $workspaceName); foreach ($queryBuilder->getQuery()->getArrayResult() as $nodeDataArray) { if ($nodeDataArray['dimensionValues'] === [] || $nodeDataArray['dimensionValues'] === '') { continue; } $foundValidDimensionValues = false; foreach ($allowedDimensionCombinations as $allowedDimensionConfiguration) { ksort($allowedDimensionConfiguration); ksort($nodeDataArray['dimensionValues']); foreach ($allowedDimensionConfiguration as $allowedDimensionKey => $allowedDimensionValuesArray) { if (isset($nodeDataArray['dimensionValues'][$allowedDimensionKey]) && isset($nodeDataArray['dimensionValues'][$allowedDimensionKey][0])) { $actualDimensionValue = $nodeDataArray['dimensionValues'][$allowedDimensionKey][0]; if (in_array($actualDimensionValue, $allowedDimensionValuesArray)) { $foundValidDimensionValues = true; break; } } } } if (!$foundValidDimensionValues) { $this->dispatch(self::EVENT_NOTICE, sprintf('Node <i>%s</i> has invalid dimension values: %s', $nodeDataArray['path'], json_encode($nodeDataArray['dimensionValues']))); $nodes[] = $nodeDataArray; } } return $nodes; }
php
protected function collectNodesWithInvalidDimensions($workspaceName, array $allowedDimensionCombinations) { $nodes = []; ksort($allowedDimensionCombinations); /** @var QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder->select('n') ->from(NodeData::class, 'n') ->where('n.workspace = :workspace') ->setParameter('workspace', $workspaceName); foreach ($queryBuilder->getQuery()->getArrayResult() as $nodeDataArray) { if ($nodeDataArray['dimensionValues'] === [] || $nodeDataArray['dimensionValues'] === '') { continue; } $foundValidDimensionValues = false; foreach ($allowedDimensionCombinations as $allowedDimensionConfiguration) { ksort($allowedDimensionConfiguration); ksort($nodeDataArray['dimensionValues']); foreach ($allowedDimensionConfiguration as $allowedDimensionKey => $allowedDimensionValuesArray) { if (isset($nodeDataArray['dimensionValues'][$allowedDimensionKey]) && isset($nodeDataArray['dimensionValues'][$allowedDimensionKey][0])) { $actualDimensionValue = $nodeDataArray['dimensionValues'][$allowedDimensionKey][0]; if (in_array($actualDimensionValue, $allowedDimensionValuesArray)) { $foundValidDimensionValues = true; break; } } } } if (!$foundValidDimensionValues) { $this->dispatch(self::EVENT_NOTICE, sprintf('Node <i>%s</i> has invalid dimension values: %s', $nodeDataArray['path'], json_encode($nodeDataArray['dimensionValues']))); $nodes[] = $nodeDataArray; } } return $nodes; }
[ "protected", "function", "collectNodesWithInvalidDimensions", "(", "$", "workspaceName", ",", "array", "$", "allowedDimensionCombinations", ")", "{", "$", "nodes", "=", "[", "]", ";", "ksort", "(", "$", "allowedDimensionCombinations", ")", ";", "/** @var QueryBuilder ...
Collects all nodes of the given node type which have dimension values not fitting to the current dimension configuration. @param string $workspaceName @param array $allowedDimensionCombinations @return array
[ "Collects", "all", "nodes", "of", "the", "given", "node", "type", "which", "have", "dimension", "values", "not", "fitting", "to", "the", "current", "dimension", "configuration", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L984-L1022
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.removeNodesWithInvalidWorkspace
public function removeNodesWithInvalidWorkspace() { $this->dispatch(self::EVENT_NOTICE, 'Checking for nodes with invalid workspace ...'); $nodesArray = $this->collectNodesWithInvalidWorkspace(); if ($nodesArray === []) { return; } $numberOfNodes = count($nodesArray); $taskDescription = sprintf('Remove <i>%d</i> node%s referring to an invalid workspace.', $numberOfNodes, $numberOfNodes > 1 ? 's' : ''); $taskClosure = function () use ($nodesArray) { foreach ($nodesArray as $nodeArray) { $this->removeNode($nodeArray['identifier'], $nodeArray['dimensionsHash']); } }; $taskRequiresConfirmation = true; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure, $taskRequiresConfirmation); }
php
public function removeNodesWithInvalidWorkspace() { $this->dispatch(self::EVENT_NOTICE, 'Checking for nodes with invalid workspace ...'); $nodesArray = $this->collectNodesWithInvalidWorkspace(); if ($nodesArray === []) { return; } $numberOfNodes = count($nodesArray); $taskDescription = sprintf('Remove <i>%d</i> node%s referring to an invalid workspace.', $numberOfNodes, $numberOfNodes > 1 ? 's' : ''); $taskClosure = function () use ($nodesArray) { foreach ($nodesArray as $nodeArray) { $this->removeNode($nodeArray['identifier'], $nodeArray['dimensionsHash']); } }; $taskRequiresConfirmation = true; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure, $taskRequiresConfirmation); }
[ "public", "function", "removeNodesWithInvalidWorkspace", "(", ")", "{", "$", "this", "->", "dispatch", "(", "self", "::", "EVENT_NOTICE", ",", "'Checking for nodes with invalid workspace ...'", ")", ";", "$", "nodesArray", "=", "$", "this", "->", "collectNodesWithInva...
Remove nodes with invalid workspace This removes nodes which refer to a workspace which does not exist. @return void
[ "Remove", "nodes", "with", "invalid", "workspace" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L1031-L1048
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.collectNodesWithInvalidWorkspace
protected function collectNodesWithInvalidWorkspace() { $nodes = []; $workspaceNames = []; foreach ($this->workspaceRepository->findAll() as $workspace) { $workspaceNames[] = $workspace->getName(); } /** @var QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder->select('n') ->from(NodeData::class, 'n') ->add('where', $queryBuilder->expr()->orX( $queryBuilder->expr()->notIn('n.workspace', $workspaceNames), $queryBuilder->expr()->isNull('n.workspace') ) ); foreach ($queryBuilder->getQuery()->getArrayResult() as $nodeDataArray) { $this->dispatch(self::EVENT_NOTICE, sprintf('Node <i>%s</i> (identifier: <i>%s</i>) refers to an invalid workspace: <i>%s</i>', $nodeDataArray['path'], $nodeDataArray['identifier'], (isset($nodeDataArray['workspace']) ? $nodeDataArray['workspace'] : 'null'))); $nodes[] = $nodeDataArray; } return $nodes; }
php
protected function collectNodesWithInvalidWorkspace() { $nodes = []; $workspaceNames = []; foreach ($this->workspaceRepository->findAll() as $workspace) { $workspaceNames[] = $workspace->getName(); } /** @var QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder->select('n') ->from(NodeData::class, 'n') ->add('where', $queryBuilder->expr()->orX( $queryBuilder->expr()->notIn('n.workspace', $workspaceNames), $queryBuilder->expr()->isNull('n.workspace') ) ); foreach ($queryBuilder->getQuery()->getArrayResult() as $nodeDataArray) { $this->dispatch(self::EVENT_NOTICE, sprintf('Node <i>%s</i> (identifier: <i>%s</i>) refers to an invalid workspace: <i>%s</i>', $nodeDataArray['path'], $nodeDataArray['identifier'], (isset($nodeDataArray['workspace']) ? $nodeDataArray['workspace'] : 'null'))); $nodes[] = $nodeDataArray; } return $nodes; }
[ "protected", "function", "collectNodesWithInvalidWorkspace", "(", ")", "{", "$", "nodes", "=", "[", "]", ";", "$", "workspaceNames", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "workspaceRepository", "->", "findAll", "(", ")", "as", "$", "worksp...
Collects all nodes of the given node type which refer to an invalid workspace configuration. Note: due to the foreign key constraints in the database, there actually never should be any node with n.workspace of a non-existing workspace because if that workspace does not exist anymore, the value would turn NULL. But the query covers this nevertheless. Better safe than sorry. @return array
[ "Collects", "all", "nodes", "of", "the", "given", "node", "type", "which", "refer", "to", "an", "invalid", "workspace", "configuration", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L1061-L1085
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.reorderChildNodes
protected function reorderChildNodes($workspaceName, $dryRun, NodeType $nodeType = null) { if ($nodeType !== null) { $this->dispatch(self::EVENT_NOTICE, sprintf('Checking nodes of type "<i>%s</i>" for child nodes that need reordering ...', $nodeType)); $this->reorderChildNodesByNodeType($workspaceName, $dryRun, $nodeType); } else { $this->dispatch(self::EVENT_NOTICE, 'Checking for child nodes that need reordering ...'); foreach ($this->nodeTypeManager->getNodeTypes() as $nodeType) { /** @var NodeType $nodeType */ if ($nodeType->isAbstract()) { continue; } $this->reorderChildNodesByNodeType($workspaceName, $dryRun, $nodeType); } } $this->persistenceManager->persistAll(); }
php
protected function reorderChildNodes($workspaceName, $dryRun, NodeType $nodeType = null) { if ($nodeType !== null) { $this->dispatch(self::EVENT_NOTICE, sprintf('Checking nodes of type "<i>%s</i>" for child nodes that need reordering ...', $nodeType)); $this->reorderChildNodesByNodeType($workspaceName, $dryRun, $nodeType); } else { $this->dispatch(self::EVENT_NOTICE, 'Checking for child nodes that need reordering ...'); foreach ($this->nodeTypeManager->getNodeTypes() as $nodeType) { /** @var NodeType $nodeType */ if ($nodeType->isAbstract()) { continue; } $this->reorderChildNodesByNodeType($workspaceName, $dryRun, $nodeType); } } $this->persistenceManager->persistAll(); }
[ "protected", "function", "reorderChildNodes", "(", "$", "workspaceName", ",", "$", "dryRun", ",", "NodeType", "$", "nodeType", "=", "null", ")", "{", "if", "(", "$", "nodeType", "!==", "null", ")", "{", "$", "this", "->", "dispatch", "(", "self", "::", ...
Reorder child nodes according to the current position configuration of child nodes. @param string $workspaceName Name of the workspace to consider @param boolean $dryRun Simulate? @param NodeType $nodeType Only for this node type, if specified @return void @throws NodeConfigurationException @throws NodeTypeNotFoundException
[ "Reorder", "child", "nodes", "according", "to", "the", "current", "position", "configuration", "of", "child", "nodes", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L1165-L1182
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.reorderChildNodesByNodeType
protected function reorderChildNodesByNodeType($workspaceName, /** @noinspection PhpUnusedParameterInspection */$dryRun, NodeType $nodeType) { $nodeTypes = $this->nodeTypeManager->getSubNodeTypes($nodeType->getName(), false); $nodeTypes[$nodeType->getName()] = $nodeType; if ($this->nodeTypeManager->hasNodeType((string)$nodeType)) { $nodeType = $this->nodeTypeManager->getNodeType((string)$nodeType); $nodeTypeNames[$nodeType->getName()] = $nodeType; } else { $this->dispatch(self::EVENT_ERROR, sprintf('Node type "<i>%s</i>" does not exist', $nodeType)); return; } /** @var $nodeType NodeType */ foreach ($nodeTypes as $nodeTypeName => $nodeType) { $childNodes = $nodeType->getAutoCreatedChildNodes(); if ($childNodes === []) { continue; } foreach ($this->getNodeDataByNodeTypeAndWorkspace($nodeTypeName, $workspaceName) as $nodeData) { /** @var NodeInterface $childNodeBefore */ $childNodeBefore = null; $context = $this->nodeFactory->createContextMatchingNodeData($nodeData); $node = $this->nodeFactory->createFromNodeData($nodeData, $context); if (!$node instanceof NodeInterface) { continue; } foreach ($childNodes as $childNodeName => $childNodeType) { $childNode = $node->getNode($childNodeName); if ($childNode) { if ($childNodeBefore && $childNodeBefore->getIndex() >= $childNode->getIndex()) { $taskDescription = sprintf('Move node named "<i>%s</i>" after node named "<i>%s</i>" in "<i>%s</i>"', $childNodeName, $childNodeBefore->getName(), $node->getPath()); $taskClosure = function () use ($childNode, $childNodeBefore) { $childNode->moveAfter($childNodeBefore); }; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure); } } else { $this->dispatch(self::EVENT_NOTICE, sprintf('Missing child node named "<i>%s</i>" in "<i>%s</i>".', $childNodeName, $node->getPath())); } $childNodeBefore = $childNode; } } } }
php
protected function reorderChildNodesByNodeType($workspaceName, /** @noinspection PhpUnusedParameterInspection */$dryRun, NodeType $nodeType) { $nodeTypes = $this->nodeTypeManager->getSubNodeTypes($nodeType->getName(), false); $nodeTypes[$nodeType->getName()] = $nodeType; if ($this->nodeTypeManager->hasNodeType((string)$nodeType)) { $nodeType = $this->nodeTypeManager->getNodeType((string)$nodeType); $nodeTypeNames[$nodeType->getName()] = $nodeType; } else { $this->dispatch(self::EVENT_ERROR, sprintf('Node type "<i>%s</i>" does not exist', $nodeType)); return; } /** @var $nodeType NodeType */ foreach ($nodeTypes as $nodeTypeName => $nodeType) { $childNodes = $nodeType->getAutoCreatedChildNodes(); if ($childNodes === []) { continue; } foreach ($this->getNodeDataByNodeTypeAndWorkspace($nodeTypeName, $workspaceName) as $nodeData) { /** @var NodeInterface $childNodeBefore */ $childNodeBefore = null; $context = $this->nodeFactory->createContextMatchingNodeData($nodeData); $node = $this->nodeFactory->createFromNodeData($nodeData, $context); if (!$node instanceof NodeInterface) { continue; } foreach ($childNodes as $childNodeName => $childNodeType) { $childNode = $node->getNode($childNodeName); if ($childNode) { if ($childNodeBefore && $childNodeBefore->getIndex() >= $childNode->getIndex()) { $taskDescription = sprintf('Move node named "<i>%s</i>" after node named "<i>%s</i>" in "<i>%s</i>"', $childNodeName, $childNodeBefore->getName(), $node->getPath()); $taskClosure = function () use ($childNode, $childNodeBefore) { $childNode->moveAfter($childNodeBefore); }; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure); } } else { $this->dispatch(self::EVENT_NOTICE, sprintf('Missing child node named "<i>%s</i>" in "<i>%s</i>".', $childNodeName, $node->getPath())); } $childNodeBefore = $childNode; } } } }
[ "protected", "function", "reorderChildNodesByNodeType", "(", "$", "workspaceName", ",", "/** @noinspection PhpUnusedParameterInspection */", "$", "dryRun", ",", "NodeType", "$", "nodeType", ")", "{", "$", "nodeTypes", "=", "$", "this", "->", "nodeTypeManager", "->", "...
Reorder child nodes for the given node type @param string $workspaceName @param boolean $dryRun (unused) @param NodeType $nodeType @return void @throws NodeTypeNotFoundException @throws NodeConfigurationException
[ "Reorder", "child", "nodes", "for", "the", "given", "node", "type" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L1194-L1240
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.repairShadowNodes
protected function repairShadowNodes($workspaceName, /** @noinspection PhpUnusedParameterInspection */$dryRun, NodeType $nodeType = null) { /** @var Workspace $workspace */ $workspace = $this->workspaceRepository->findByIdentifier($workspaceName); if ($workspace->getBaseWorkspace() === null) { $this->dispatch(self::EVENT_NOTICE, sprintf('Repairing base workspace "<i>%s</i>", therefore skipping check for shadow nodes.', $workspaceName)); return; } $this->dispatch(self::EVENT_NOTICE, 'Checking for nodes with missing shadow nodes ...'); $newShadowNodes = $this->findMissingShadowNodesInWorkspace($workspace, $nodeType); if ($newShadowNodes === []) { return; } $numberOfNewShadowNodes = count($newShadowNodes); $taskDescription = sprintf('Add <i>%d</i> missing shadow node%s', $numberOfNewShadowNodes, $numberOfNewShadowNodes > 1 ? 's' : ''); $taskClosure = function () use ($newShadowNodes) { /** @var NodeData $nodeData */ foreach ($newShadowNodes as list('nodeData' => $nodeData, 'shadowPath' => $shadowPath)) { $nodeData->createShadow($shadowPath); } $this->persistenceManager->persistAll(); }; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure); }
php
protected function repairShadowNodes($workspaceName, /** @noinspection PhpUnusedParameterInspection */$dryRun, NodeType $nodeType = null) { /** @var Workspace $workspace */ $workspace = $this->workspaceRepository->findByIdentifier($workspaceName); if ($workspace->getBaseWorkspace() === null) { $this->dispatch(self::EVENT_NOTICE, sprintf('Repairing base workspace "<i>%s</i>", therefore skipping check for shadow nodes.', $workspaceName)); return; } $this->dispatch(self::EVENT_NOTICE, 'Checking for nodes with missing shadow nodes ...'); $newShadowNodes = $this->findMissingShadowNodesInWorkspace($workspace, $nodeType); if ($newShadowNodes === []) { return; } $numberOfNewShadowNodes = count($newShadowNodes); $taskDescription = sprintf('Add <i>%d</i> missing shadow node%s', $numberOfNewShadowNodes, $numberOfNewShadowNodes > 1 ? 's' : ''); $taskClosure = function () use ($newShadowNodes) { /** @var NodeData $nodeData */ foreach ($newShadowNodes as list('nodeData' => $nodeData, 'shadowPath' => $shadowPath)) { $nodeData->createShadow($shadowPath); } $this->persistenceManager->persistAll(); }; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure); }
[ "protected", "function", "repairShadowNodes", "(", "$", "workspaceName", ",", "/** @noinspection PhpUnusedParameterInspection */", "$", "dryRun", ",", "NodeType", "$", "nodeType", "=", "null", ")", "{", "/** @var Workspace $workspace */", "$", "workspace", "=", "$", "th...
Repair nodes whose shadow nodes are missing This check searches for nodes which have a corresponding node in one of the base workspaces, have different node paths, but don't have a corresponding shadow node with a "movedto" value. @param string $workspaceName Currently ignored @param boolean $dryRun (unused) @param NodeType $nodeType This argument will be ignored @return void
[ "Repair", "nodes", "whose", "shadow", "nodes", "are", "missing" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L1253-L1278
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.findMissingShadowNodesInWorkspace
protected function findMissingShadowNodesInWorkspace(Workspace $workspace, NodeType $nodeType = null) { $workspaces = array_merge([$workspace], $workspace->getBaseWorkspaces()); $newShadowNodes = []; foreach ($workspaces as $workspace) { /** @var Workspace $workspace */ if ($workspace->getBaseWorkspace() === null) { continue; } /** @var QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder->select('n') ->from(NodeData::class, 'n') ->where('n.workspace = :workspace'); $queryBuilder->setParameter('workspace', $workspace->getName()); if ($nodeType !== null) { $queryBuilder->andWhere('n.nodeType = :nodeType'); $queryBuilder->setParameter('nodeType', $nodeType->getName()); } /** @var NodeData $nodeData */ foreach ($queryBuilder->getQuery()->getResult() as $nodeData) { $nodeDataSeenFromParentWorkspace = $this->nodeDataRepository->findOneByIdentifier($nodeData->getIdentifier(), $workspace->getBaseWorkspace(), $nodeData->getDimensionValues()); // This is the good case, either the node does not exist or was shadowed if ($nodeDataSeenFromParentWorkspace === null) { continue; } // Also good, the node was not moved at all. if ($nodeDataSeenFromParentWorkspace->getPath() === $nodeData->getPath()) { continue; } $nodeDataOnSamePath = $this->nodeDataRepository->findOneByPath($nodeData->getPath(), $workspace->getBaseWorkspace(), $nodeData->getDimensionValues(), null); // We cannot just put a shadow node in the path, something exists, but that should be fine. if ($nodeDataOnSamePath !== null) { continue; } $newShadowNodes[] = ['nodeData' => $nodeData, 'shadowPath' => $nodeDataSeenFromParentWorkspace->getPath()]; } } return $newShadowNodes; }
php
protected function findMissingShadowNodesInWorkspace(Workspace $workspace, NodeType $nodeType = null) { $workspaces = array_merge([$workspace], $workspace->getBaseWorkspaces()); $newShadowNodes = []; foreach ($workspaces as $workspace) { /** @var Workspace $workspace */ if ($workspace->getBaseWorkspace() === null) { continue; } /** @var QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder->select('n') ->from(NodeData::class, 'n') ->where('n.workspace = :workspace'); $queryBuilder->setParameter('workspace', $workspace->getName()); if ($nodeType !== null) { $queryBuilder->andWhere('n.nodeType = :nodeType'); $queryBuilder->setParameter('nodeType', $nodeType->getName()); } /** @var NodeData $nodeData */ foreach ($queryBuilder->getQuery()->getResult() as $nodeData) { $nodeDataSeenFromParentWorkspace = $this->nodeDataRepository->findOneByIdentifier($nodeData->getIdentifier(), $workspace->getBaseWorkspace(), $nodeData->getDimensionValues()); // This is the good case, either the node does not exist or was shadowed if ($nodeDataSeenFromParentWorkspace === null) { continue; } // Also good, the node was not moved at all. if ($nodeDataSeenFromParentWorkspace->getPath() === $nodeData->getPath()) { continue; } $nodeDataOnSamePath = $this->nodeDataRepository->findOneByPath($nodeData->getPath(), $workspace->getBaseWorkspace(), $nodeData->getDimensionValues(), null); // We cannot just put a shadow node in the path, something exists, but that should be fine. if ($nodeDataOnSamePath !== null) { continue; } $newShadowNodes[] = ['nodeData' => $nodeData, 'shadowPath' => $nodeDataSeenFromParentWorkspace->getPath()]; } } return $newShadowNodes; }
[ "protected", "function", "findMissingShadowNodesInWorkspace", "(", "Workspace", "$", "workspace", ",", "NodeType", "$", "nodeType", "=", "null", ")", "{", "$", "workspaces", "=", "array_merge", "(", "[", "$", "workspace", "]", ",", "$", "workspace", "->", "get...
Collects all nodes with missing shadow nodes @param Workspace $workspace @param NodeType $nodeType @return array in the form [['nodeData' => <nodeDataInstance>, 'shadowPath' => '<shadowPath>'], ...]
[ "Collects", "all", "nodes", "with", "missing", "shadow", "nodes" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L1287-L1331
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.on
public function on(string $eventIdentifier, \Closure $callback): void { $this->eventCallbacks[$eventIdentifier][] = $callback; }
php
public function on(string $eventIdentifier, \Closure $callback): void { $this->eventCallbacks[$eventIdentifier][] = $callback; }
[ "public", "function", "on", "(", "string", "$", "eventIdentifier", ",", "\\", "Closure", "$", "callback", ")", ":", "void", "{", "$", "this", "->", "eventCallbacks", "[", "$", "eventIdentifier", "]", "[", "]", "=", "$", "callback", ";", "}" ]
Attaches a new event handler @param string $eventIdentifier one of the EVENT_* constants @param \Closure $callback a closure to be invoked when the corresponding event was triggered @return void
[ "Attaches", "a", "new", "event", "handler" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php#L1340-L1343
train
neos/neos-development-collection
Neos.Neos/Classes/Service/XliffService.php
XliffService.getCachedJson
public function getCachedJson(Locale $locale) { $cacheIdentifier = md5($locale); if ($this->xliffToJsonTranslationsCache->has($cacheIdentifier)) { $json = $this->xliffToJsonTranslationsCache->get($cacheIdentifier); } else { $labels = []; foreach ($this->packagesRegisteredForAutoInclusion as $packageKey => $sourcesToBeIncluded) { if (!is_array($sourcesToBeIncluded)) { continue; } $package = $this->packageManager->getPackage($packageKey); $sources = $this->collectPackageSources($package, $sourcesToBeIncluded); //get the xliff files for those sources foreach ($sources as $sourceName) { $fileId = $packageKey . ':' . $sourceName; $file = $this->xliffFileProvider->getFile($fileId, $locale); foreach ($file->getTranslationUnits() as $key => $value) { $valueToStore = !empty($value[0]['target']) ? $value[0]['target'] : $value[0]['source']; if ($this->scrambleTranslatedLabels) { $valueToStore = str_repeat('#', UnicodeFunctions::strlen($valueToStore)); } $this->setArrayDataValue($labels, str_replace('.', '_', $packageKey) . '.' . str_replace('/', '_', $sourceName) . '.' . str_replace('.', '_', $key), $valueToStore); } } } $json = json_encode($labels); $this->xliffToJsonTranslationsCache->set($cacheIdentifier, $json); } return $json; }
php
public function getCachedJson(Locale $locale) { $cacheIdentifier = md5($locale); if ($this->xliffToJsonTranslationsCache->has($cacheIdentifier)) { $json = $this->xliffToJsonTranslationsCache->get($cacheIdentifier); } else { $labels = []; foreach ($this->packagesRegisteredForAutoInclusion as $packageKey => $sourcesToBeIncluded) { if (!is_array($sourcesToBeIncluded)) { continue; } $package = $this->packageManager->getPackage($packageKey); $sources = $this->collectPackageSources($package, $sourcesToBeIncluded); //get the xliff files for those sources foreach ($sources as $sourceName) { $fileId = $packageKey . ':' . $sourceName; $file = $this->xliffFileProvider->getFile($fileId, $locale); foreach ($file->getTranslationUnits() as $key => $value) { $valueToStore = !empty($value[0]['target']) ? $value[0]['target'] : $value[0]['source']; if ($this->scrambleTranslatedLabels) { $valueToStore = str_repeat('#', UnicodeFunctions::strlen($valueToStore)); } $this->setArrayDataValue($labels, str_replace('.', '_', $packageKey) . '.' . str_replace('/', '_', $sourceName) . '.' . str_replace('.', '_', $key), $valueToStore); } } } $json = json_encode($labels); $this->xliffToJsonTranslationsCache->set($cacheIdentifier, $json); } return $json; }
[ "public", "function", "getCachedJson", "(", "Locale", "$", "locale", ")", "{", "$", "cacheIdentifier", "=", "md5", "(", "$", "locale", ")", ";", "if", "(", "$", "this", "->", "xliffToJsonTranslationsCache", "->", "has", "(", "$", "cacheIdentifier", ")", ")...
Return the json array for a given locale, sourceCatalog, xliffPath and package. The json will be cached. @param Locale $locale The locale @return Result @throws Exception
[ "Return", "the", "json", "array", "for", "a", "given", "locale", "sourceCatalog", "xliffPath", "and", "package", ".", "The", "json", "will", "be", "cached", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/XliffService.php#L91-L128
train
neos/neos-development-collection
Neos.Neos/Classes/Service/XliffService.php
XliffService.setArrayDataValue
protected function setArrayDataValue(array &$arrayPointer, $key, $value) { $keys = explode('.', $key); // Extract the last key $lastKey = array_pop($keys); // Walk/build the array to the specified key while ($arrayKey = array_shift($keys)) { if (!array_key_exists($arrayKey, $arrayPointer)) { $arrayPointer[$arrayKey] = []; } $arrayPointer = &$arrayPointer[$arrayKey]; } // Set the final key $arrayPointer[$lastKey] = $value; }
php
protected function setArrayDataValue(array &$arrayPointer, $key, $value) { $keys = explode('.', $key); // Extract the last key $lastKey = array_pop($keys); // Walk/build the array to the specified key while ($arrayKey = array_shift($keys)) { if (!array_key_exists($arrayKey, $arrayPointer)) { $arrayPointer[$arrayKey] = []; } $arrayPointer = &$arrayPointer[$arrayKey]; } // Set the final key $arrayPointer[$lastKey] = $value; }
[ "protected", "function", "setArrayDataValue", "(", "array", "&", "$", "arrayPointer", ",", "$", "key", ",", "$", "value", ")", "{", "$", "keys", "=", "explode", "(", "'.'", ",", "$", "key", ")", ";", "// Extract the last key", "$", "lastKey", "=", "array...
Helper method to create the needed json array from a dotted xliff id @param array $arrayPointer @param string $key @param string $value @return void
[ "Helper", "method", "to", "create", "the", "needed", "json", "array", "from", "a", "dotted", "xliff", "id" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/XliffService.php#L208-L225
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/NodeType.php
NodeType.initialize
protected function initialize() { if ($this->initialized === true) { return; } $this->initialized = true; $this->buildFullConfiguration(); $this->applyPostprocessing(); }
php
protected function initialize() { if ($this->initialized === true) { return; } $this->initialized = true; $this->buildFullConfiguration(); $this->applyPostprocessing(); }
[ "protected", "function", "initialize", "(", ")", "{", "if", "(", "$", "this", "->", "initialized", "===", "true", ")", "{", "return", ";", "}", "$", "this", "->", "initialized", "=", "true", ";", "$", "this", "->", "buildFullConfiguration", "(", ")", "...
Initializes this node type @return void
[ "Initializes", "this", "node", "type" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeType.php#L144-L152
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/NodeType.php
NodeType.buildFullConfiguration
protected function buildFullConfiguration() { $mergedConfiguration = []; $applicableSuperTypes = static::getFlattenedSuperTypes($this); foreach ($applicableSuperTypes as $key => $superType) { $mergedConfiguration = Arrays::arrayMergeRecursiveOverrule($mergedConfiguration, $superType->getLocalConfiguration()); } $this->fullConfiguration = Arrays::arrayMergeRecursiveOverrule($mergedConfiguration, $this->localConfiguration); if (isset($this->fullConfiguration['childNodes']) && is_array($this->fullConfiguration['childNodes']) && $this->fullConfiguration['childNodes'] !== []) { $sorter = new PositionalArraySorter($this->fullConfiguration['childNodes']); $this->fullConfiguration['childNodes'] = $sorter->toArray(); } }
php
protected function buildFullConfiguration() { $mergedConfiguration = []; $applicableSuperTypes = static::getFlattenedSuperTypes($this); foreach ($applicableSuperTypes as $key => $superType) { $mergedConfiguration = Arrays::arrayMergeRecursiveOverrule($mergedConfiguration, $superType->getLocalConfiguration()); } $this->fullConfiguration = Arrays::arrayMergeRecursiveOverrule($mergedConfiguration, $this->localConfiguration); if (isset($this->fullConfiguration['childNodes']) && is_array($this->fullConfiguration['childNodes']) && $this->fullConfiguration['childNodes'] !== []) { $sorter = new PositionalArraySorter($this->fullConfiguration['childNodes']); $this->fullConfiguration['childNodes'] = $sorter->toArray(); } }
[ "protected", "function", "buildFullConfiguration", "(", ")", "{", "$", "mergedConfiguration", "=", "[", "]", ";", "$", "applicableSuperTypes", "=", "static", "::", "getFlattenedSuperTypes", "(", "$", "this", ")", ";", "foreach", "(", "$", "applicableSuperTypes", ...
Builds the full configuration by merging configuration from the supertypes into the local configuration. @return void
[ "Builds", "the", "full", "configuration", "by", "merging", "configuration", "from", "the", "supertypes", "into", "the", "local", "configuration", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeType.php#L159-L172
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/NodeType.php
NodeType.getFlattenedSuperTypes
protected static function getFlattenedSuperTypes(NodeType $nodeType) : array { $flattenedSuperTypes = []; foreach ($nodeType->declaredSuperTypes as $superTypeName => $superType) { if ($superType !== null) { $flattenedSuperTypes += static::getFlattenedSuperTypes($superType); $flattenedSuperTypes[$superTypeName] = $superType; } } foreach ($nodeType->declaredSuperTypes as $superTypeName => $superType) { if ($superType === null) { unset($flattenedSuperTypes[$superTypeName]); } } return $flattenedSuperTypes; }
php
protected static function getFlattenedSuperTypes(NodeType $nodeType) : array { $flattenedSuperTypes = []; foreach ($nodeType->declaredSuperTypes as $superTypeName => $superType) { if ($superType !== null) { $flattenedSuperTypes += static::getFlattenedSuperTypes($superType); $flattenedSuperTypes[$superTypeName] = $superType; } } foreach ($nodeType->declaredSuperTypes as $superTypeName => $superType) { if ($superType === null) { unset($flattenedSuperTypes[$superTypeName]); } } return $flattenedSuperTypes; }
[ "protected", "static", "function", "getFlattenedSuperTypes", "(", "NodeType", "$", "nodeType", ")", ":", "array", "{", "$", "flattenedSuperTypes", "=", "[", "]", ";", "foreach", "(", "$", "nodeType", "->", "declaredSuperTypes", "as", "$", "superTypeName", "=>", ...
Returns a flat list of super types to inherit from. @param NodeType $nodeType @return array
[ "Returns", "a", "flat", "list", "of", "super", "types", "to", "inherit", "from", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeType.php#L181-L198
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/NodeType.php
NodeType.applyPostprocessing
protected function applyPostprocessing() { if (!isset($this->fullConfiguration['postprocessors'])) { return; } foreach ($this->fullConfiguration['postprocessors'] as $postprocessorConfiguration) { $postprocessor = new $postprocessorConfiguration['postprocessor'](); if (!$postprocessor instanceof NodeTypePostprocessorInterface) { throw new InvalidNodeTypePostprocessorException(sprintf('Expected NodeTypePostprocessorInterface but got "%s"', get_class($postprocessor)), 1364759955); } $postprocessorOptions = []; if (isset($postprocessorConfiguration['postprocessorOptions'])) { $postprocessorOptions = $postprocessorConfiguration['postprocessorOptions']; } $postprocessor->process($this, $this->fullConfiguration, $postprocessorOptions); } }
php
protected function applyPostprocessing() { if (!isset($this->fullConfiguration['postprocessors'])) { return; } foreach ($this->fullConfiguration['postprocessors'] as $postprocessorConfiguration) { $postprocessor = new $postprocessorConfiguration['postprocessor'](); if (!$postprocessor instanceof NodeTypePostprocessorInterface) { throw new InvalidNodeTypePostprocessorException(sprintf('Expected NodeTypePostprocessorInterface but got "%s"', get_class($postprocessor)), 1364759955); } $postprocessorOptions = []; if (isset($postprocessorConfiguration['postprocessorOptions'])) { $postprocessorOptions = $postprocessorConfiguration['postprocessorOptions']; } $postprocessor->process($this, $this->fullConfiguration, $postprocessorOptions); } }
[ "protected", "function", "applyPostprocessing", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "fullConfiguration", "[", "'postprocessors'", "]", ")", ")", "{", "return", ";", "}", "foreach", "(", "$", "this", "->", "fullConfiguration", "[...
Iterates through configured postprocessors and invokes them @return void @throws InvalidNodeTypePostprocessorException
[ "Iterates", "through", "configured", "postprocessors", "and", "invokes", "them" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeType.php#L206-L222
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/NodeType.php
NodeType.getNodeLabelGenerator
public function getNodeLabelGenerator() { $this->initialize(); if ($this->nodeLabelGenerator === null) { if ($this->hasConfiguration('label.generatorClass')) { $nodeLabelGenerator = $this->objectManager->get($this->getConfiguration('label.generatorClass')); } elseif ($this->hasConfiguration('label') && is_string($this->getConfiguration('label'))) { $nodeLabelGenerator = $this->objectManager->get(ExpressionBasedNodeLabelGenerator::class); $nodeLabelGenerator->setExpression($this->getConfiguration('label')); } else { $nodeLabelGenerator = $this->objectManager->get(NodeLabelGeneratorInterface::class); } $this->nodeLabelGenerator = $nodeLabelGenerator; } return $this->nodeLabelGenerator; }
php
public function getNodeLabelGenerator() { $this->initialize(); if ($this->nodeLabelGenerator === null) { if ($this->hasConfiguration('label.generatorClass')) { $nodeLabelGenerator = $this->objectManager->get($this->getConfiguration('label.generatorClass')); } elseif ($this->hasConfiguration('label') && is_string($this->getConfiguration('label'))) { $nodeLabelGenerator = $this->objectManager->get(ExpressionBasedNodeLabelGenerator::class); $nodeLabelGenerator->setExpression($this->getConfiguration('label')); } else { $nodeLabelGenerator = $this->objectManager->get(NodeLabelGeneratorInterface::class); } $this->nodeLabelGenerator = $nodeLabelGenerator; } return $this->nodeLabelGenerator; }
[ "public", "function", "getNodeLabelGenerator", "(", ")", "{", "$", "this", "->", "initialize", "(", ")", ";", "if", "(", "$", "this", "->", "nodeLabelGenerator", "===", "null", ")", "{", "if", "(", "$", "this", "->", "hasConfiguration", "(", "'label.genera...
Return the node label generator class for the given node @return NodeLabelGeneratorInterface
[ "Return", "the", "node", "label", "generator", "class", "for", "the", "given", "node" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeType.php#L393-L411
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/NodeType.php
NodeType.getPropertyType
public function getPropertyType($propertyName) { if (!isset($this->fullConfiguration['properties']) || !isset($this->fullConfiguration['properties'][$propertyName]) || !isset($this->fullConfiguration['properties'][$propertyName]['type'])) { return 'string'; } return $this->fullConfiguration['properties'][$propertyName]['type']; }
php
public function getPropertyType($propertyName) { if (!isset($this->fullConfiguration['properties']) || !isset($this->fullConfiguration['properties'][$propertyName]) || !isset($this->fullConfiguration['properties'][$propertyName]['type'])) { return 'string'; } return $this->fullConfiguration['properties'][$propertyName]['type']; }
[ "public", "function", "getPropertyType", "(", "$", "propertyName", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "fullConfiguration", "[", "'properties'", "]", ")", "||", "!", "isset", "(", "$", "this", "->", "fullConfiguration", "[", "'proper...
Returns the configured type of the specified property @param string $propertyName Name of the property @return string
[ "Returns", "the", "configured", "type", "of", "the", "specified", "property" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeType.php#L433-L439
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/NodeType.php
NodeType.getDefaultValuesForProperties
public function getDefaultValuesForProperties() { $this->initialize(); if (!isset($this->fullConfiguration['properties'])) { return []; } $defaultValues = []; foreach ($this->fullConfiguration['properties'] as $propertyName => $propertyConfiguration) { if (isset($propertyConfiguration['defaultValue'])) { $type = isset($propertyConfiguration['type']) ? $propertyConfiguration['type'] : ''; switch ($type) { case 'DateTime': $defaultValues[$propertyName] = new \DateTime($propertyConfiguration['defaultValue']); break; default: $defaultValues[$propertyName] = $propertyConfiguration['defaultValue']; } } } return $defaultValues; }
php
public function getDefaultValuesForProperties() { $this->initialize(); if (!isset($this->fullConfiguration['properties'])) { return []; } $defaultValues = []; foreach ($this->fullConfiguration['properties'] as $propertyName => $propertyConfiguration) { if (isset($propertyConfiguration['defaultValue'])) { $type = isset($propertyConfiguration['type']) ? $propertyConfiguration['type'] : ''; switch ($type) { case 'DateTime': $defaultValues[$propertyName] = new \DateTime($propertyConfiguration['defaultValue']); break; default: $defaultValues[$propertyName] = $propertyConfiguration['defaultValue']; } } } return $defaultValues; }
[ "public", "function", "getDefaultValuesForProperties", "(", ")", "{", "$", "this", "->", "initialize", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "fullConfiguration", "[", "'properties'", "]", ")", ")", "{", "return", "[", "]", ";", ...
Return an array with the defined default values for each property, if any. The default value is configured for each property under the "default" key. @return array @api
[ "Return", "an", "array", "with", "the", "defined", "default", "values", "for", "each", "property", "if", "any", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeType.php#L449-L471
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/NodeType.php
NodeType.getAutoCreatedChildNodes
public function getAutoCreatedChildNodes() { $this->initialize(); if (!isset($this->fullConfiguration['childNodes'])) { return []; } $autoCreatedChildNodes = []; foreach ($this->fullConfiguration['childNodes'] as $childNodeName => $childNodeConfiguration) { if (isset($childNodeConfiguration['type'])) { $autoCreatedChildNodes[Utility::renderValidNodeName($childNodeName)] = $this->nodeTypeManager->getNodeType($childNodeConfiguration['type']); } } return $autoCreatedChildNodes; }
php
public function getAutoCreatedChildNodes() { $this->initialize(); if (!isset($this->fullConfiguration['childNodes'])) { return []; } $autoCreatedChildNodes = []; foreach ($this->fullConfiguration['childNodes'] as $childNodeName => $childNodeConfiguration) { if (isset($childNodeConfiguration['type'])) { $autoCreatedChildNodes[Utility::renderValidNodeName($childNodeName)] = $this->nodeTypeManager->getNodeType($childNodeConfiguration['type']); } } return $autoCreatedChildNodes; }
[ "public", "function", "getAutoCreatedChildNodes", "(", ")", "{", "$", "this", "->", "initialize", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "fullConfiguration", "[", "'childNodes'", "]", ")", ")", "{", "return", "[", "]", ";", "}"...
Return an array with child nodes which should be automatically created @return self[] the key of this array is the name of the child, and the value its NodeType. @api
[ "Return", "an", "array", "with", "child", "nodes", "which", "should", "be", "automatically", "created" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeType.php#L479-L494
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/NodeType.php
NodeType.allowsChildNodeType
public function allowsChildNodeType(NodeType $nodeType) { $constraints = $this->getConfiguration('constraints.nodeTypes') ?: []; return $this->isNodeTypeAllowedByConstraints($nodeType, $constraints); }
php
public function allowsChildNodeType(NodeType $nodeType) { $constraints = $this->getConfiguration('constraints.nodeTypes') ?: []; return $this->isNodeTypeAllowedByConstraints($nodeType, $constraints); }
[ "public", "function", "allowsChildNodeType", "(", "NodeType", "$", "nodeType", ")", "{", "$", "constraints", "=", "$", "this", "->", "getConfiguration", "(", "'constraints.nodeTypes'", ")", "?", ":", "[", "]", ";", "return", "$", "this", "->", "isNodeTypeAllow...
Checks if the given NodeType is acceptable as sub-node with the configured constraints, not taking constraints of auto-created nodes into account. Thus, this method only returns the correct result if called on NON-AUTO-CREATED nodes! Otherwise, allowsGrandchildNodeType() needs to be called on the *parent node type*. @param NodeType $nodeType @return boolean true if the $nodeType is allowed as child node, false otherwise.
[ "Checks", "if", "the", "given", "NodeType", "is", "acceptable", "as", "sub", "-", "node", "with", "the", "configured", "constraints", "not", "taking", "constraints", "of", "auto", "-", "created", "nodes", "into", "account", ".", "Thus", "this", "method", "on...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeType.php#L528-L532
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/NodeType.php
NodeType.traverseSuperTypes
protected function traverseSuperTypes(NodeType $currentNodeType, $constraintNodeTypeName, $distance) { if ($currentNodeType->getName() === $constraintNodeTypeName) { return $distance; } $distance++; foreach ($currentNodeType->getDeclaredSuperTypes() as $superType) { $result = $this->traverseSuperTypes($superType, $constraintNodeTypeName, $distance); if ($result !== null) { return $result; } } return null; }
php
protected function traverseSuperTypes(NodeType $currentNodeType, $constraintNodeTypeName, $distance) { if ($currentNodeType->getName() === $constraintNodeTypeName) { return $distance; } $distance++; foreach ($currentNodeType->getDeclaredSuperTypes() as $superType) { $result = $this->traverseSuperTypes($superType, $constraintNodeTypeName, $distance); if ($result !== null) { return $result; } } return null; }
[ "protected", "function", "traverseSuperTypes", "(", "NodeType", "$", "currentNodeType", ",", "$", "constraintNodeTypeName", ",", "$", "distance", ")", "{", "if", "(", "$", "currentNodeType", "->", "getName", "(", ")", "===", "$", "constraintNodeTypeName", ")", "...
This method traverses the given node type to find the first super type that matches the constraint node type. In case the hierarchy has more than one way of finding a path to the node type it's not taken into account, since the first matched is returned. This is accepted on purpose for performance reasons and due to the fact that such hierarchies should be avoided. @param NodeType $currentNodeType @param string $constraintNodeTypeName @param integer $distance @return integer or NULL if no NodeType matched
[ "This", "method", "traverses", "the", "given", "node", "type", "to", "find", "the", "first", "super", "type", "that", "matches", "the", "constraint", "node", "type", ".", "In", "case", "the", "hierarchy", "has", "more", "than", "one", "way", "of", "finding...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/NodeType.php#L673-L688
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/AssetCollection.php
AssetCollection.addAsset
public function addAsset(Asset $asset): bool { if ($asset->getAssetCollections()->contains($this) === false) { $this->assets->add($asset); return true; } return false; }
php
public function addAsset(Asset $asset): bool { if ($asset->getAssetCollections()->contains($this) === false) { $this->assets->add($asset); return true; } return false; }
[ "public", "function", "addAsset", "(", "Asset", "$", "asset", ")", ":", "bool", "{", "if", "(", "$", "asset", "->", "getAssetCollections", "(", ")", "->", "contains", "(", "$", "this", ")", "===", "false", ")", "{", "$", "this", "->", "assets", "->",...
Add one asset to the asset collection @param Asset $asset @return bool
[ "Add", "one", "asset", "to", "the", "asset", "collection" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/AssetCollection.php#L105-L113
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/AssetCollection.php
AssetCollection.removeAsset
public function removeAsset(Asset $asset): bool { if ($asset->getAssetCollections()->contains($this) === false) { $this->assets->removeElement($asset); return true; } return false; }
php
public function removeAsset(Asset $asset): bool { if ($asset->getAssetCollections()->contains($this) === false) { $this->assets->removeElement($asset); return true; } return false; }
[ "public", "function", "removeAsset", "(", "Asset", "$", "asset", ")", ":", "bool", "{", "if", "(", "$", "asset", "->", "getAssetCollections", "(", ")", "->", "contains", "(", "$", "this", ")", "===", "false", ")", "{", "$", "this", "->", "assets", "-...
Remove one asset from the asset collection @param Asset $asset @return bool
[ "Remove", "one", "asset", "from", "the", "asset", "collection" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/AssetCollection.php#L121-L128
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/AssetCollection.php
AssetCollection.addTag
public function addTag(Tag $tag) { if (!$this->tags->contains($tag)) { $this->tags->add($tag); return true; } return false; }
php
public function addTag(Tag $tag) { if (!$this->tags->contains($tag)) { $this->tags->add($tag); return true; } return false; }
[ "public", "function", "addTag", "(", "Tag", "$", "tag", ")", "{", "if", "(", "!", "$", "this", "->", "tags", "->", "contains", "(", "$", "tag", ")", ")", "{", "$", "this", "->", "tags", "->", "add", "(", "$", "tag", ")", ";", "return", "true", ...
Add a single tag to this asset @param Tag $tag @return boolean
[ "Add", "a", "single", "tag", "to", "this", "asset" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/AssetCollection.php#L146-L153
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/AssetCollection.php
AssetCollection.removeTag
public function removeTag(Tag $tag) { if ($this->tags->contains($tag)) { $this->tags->removeElement($tag); return true; } return false; }
php
public function removeTag(Tag $tag) { if ($this->tags->contains($tag)) { $this->tags->removeElement($tag); return true; } return false; }
[ "public", "function", "removeTag", "(", "Tag", "$", "tag", ")", "{", "if", "(", "$", "this", "->", "tags", "->", "contains", "(", "$", "tag", ")", ")", "{", "$", "this", "->", "tags", "->", "removeElement", "(", "$", "tag", ")", ";", "return", "t...
Remove a single tag from this asset @param Tag $tag @return boolean
[ "Remove", "a", "single", "tag", "from", "this", "asset" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/AssetCollection.php#L172-L179
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Strategy/ConfigurationAssetModelMappingStrategy.php
ConfigurationAssetModelMappingStrategy.map
public function map(PersistentResource $resource, array $additionalProperties = []) { $mediaType = MediaTypes::getMediaTypeFromFilename($resource->getFilename()); foreach ($this->settings['patterns'] as $pattern => $mappingInformation) { if (preg_match($pattern, $mediaType)) { return $mappingInformation['className']; } } return $this->settings['default']; }
php
public function map(PersistentResource $resource, array $additionalProperties = []) { $mediaType = MediaTypes::getMediaTypeFromFilename($resource->getFilename()); foreach ($this->settings['patterns'] as $pattern => $mappingInformation) { if (preg_match($pattern, $mediaType)) { return $mappingInformation['className']; } } return $this->settings['default']; }
[ "public", "function", "map", "(", "PersistentResource", "$", "resource", ",", "array", "$", "additionalProperties", "=", "[", "]", ")", "{", "$", "mediaType", "=", "MediaTypes", "::", "getMediaTypeFromFilename", "(", "$", "resource", "->", "getFilename", "(", ...
Map the given resource to a media model class. @param PersistentResource $resource @param array $additionalProperties Optional properties that can be taken into account for deciding the model class. what you get here can depend on the caller, so you should always fallback to something based on the resource. @return string
[ "Map", "the", "given", "resource", "to", "a", "media", "model", "class", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Strategy/ConfigurationAssetModelMappingStrategy.php#L48-L58
train
neos/neos-development-collection
Neos.Neos/Classes/ViewHelpers/Backend/UserInitialsViewHelper.php
UserInitialsViewHelper.render
public function render($format = 'initials') { if (!in_array($format, ['fullFirstName', 'initials', 'fullName'])) { throw new \InvalidArgumentException(sprintf('Format "%s" given to backend.userInitials(), only supporting "fullFirstName", "initials" and "fullName".', $format), 1415705861); } $username = $this->renderChildren(); /* @var $requestedUser Person */ $requestedUser = $this->domainUserService->getUser($username); if ($requestedUser === null || $requestedUser->getName() === null) { return $username; } $currentUser = $this->userService->getBackendUser(); if ($currentUser) { if ($currentUser === $requestedUser) { $translationHelper = new TranslationHelper(); $you = $translationHelper->translate('you', null, [], 'Main', 'Neos.Neos'); } } switch ($format) { case 'initials': return mb_substr(preg_replace('/[^[:alnum:][:space:]]/u', '', $requestedUser->getName()->getFirstName()), 0, 1) . mb_substr(preg_replace('/[^[:alnum:][:space:]]/u', '', $requestedUser->getName()->getLastName()), 0, 1); case 'fullFirstName': return isset($you) ? $you : trim($requestedUser->getName()->getFirstName() . ' ' . ltrim(mb_substr($requestedUser->getName()->getLastName(), 0, 1) . '.', '.')); case 'fullName': return isset($you) ? $you : $requestedUser->getName()->getFullName(); } }
php
public function render($format = 'initials') { if (!in_array($format, ['fullFirstName', 'initials', 'fullName'])) { throw new \InvalidArgumentException(sprintf('Format "%s" given to backend.userInitials(), only supporting "fullFirstName", "initials" and "fullName".', $format), 1415705861); } $username = $this->renderChildren(); /* @var $requestedUser Person */ $requestedUser = $this->domainUserService->getUser($username); if ($requestedUser === null || $requestedUser->getName() === null) { return $username; } $currentUser = $this->userService->getBackendUser(); if ($currentUser) { if ($currentUser === $requestedUser) { $translationHelper = new TranslationHelper(); $you = $translationHelper->translate('you', null, [], 'Main', 'Neos.Neos'); } } switch ($format) { case 'initials': return mb_substr(preg_replace('/[^[:alnum:][:space:]]/u', '', $requestedUser->getName()->getFirstName()), 0, 1) . mb_substr(preg_replace('/[^[:alnum:][:space:]]/u', '', $requestedUser->getName()->getLastName()), 0, 1); case 'fullFirstName': return isset($you) ? $you : trim($requestedUser->getName()->getFirstName() . ' ' . ltrim(mb_substr($requestedUser->getName()->getLastName(), 0, 1) . '.', '.')); case 'fullName': return isset($you) ? $you : $requestedUser->getName()->getFullName(); } }
[ "public", "function", "render", "(", "$", "format", "=", "'initials'", ")", "{", "if", "(", "!", "in_array", "(", "$", "format", ",", "[", "'fullFirstName'", ",", "'initials'", ",", "'fullName'", "]", ")", ")", "{", "throw", "new", "\\", "InvalidArgument...
Render user initials or an abbreviated name for a given username. If the account was deleted, use the username as fallback. @param string $format Supported are "fullFirstName", "initials" and "fullName" @return string @throws \Neos\Neos\Domain\Exception
[ "Render", "user", "initials", "or", "an", "abbreviated", "name", "for", "a", "given", "username", ".", "If", "the", "account", "was", "deleted", "use", "the", "username", "as", "fallback", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/ViewHelpers/Backend/UserInitialsViewHelper.php#L54-L84
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/AbstractNodeData.php
AbstractNodeData.setProperty
public function setProperty($propertyName, $value) { if (!is_object($this->contentObjectProxy)) { switch ($this->getNodeType()->getPropertyType($propertyName)) { case 'references': $nodeIdentifiers = []; if (is_array($value)) { foreach ($value as $nodeIdentifier) { if ($nodeIdentifier instanceof NodeInterface || $nodeIdentifier instanceof AbstractNodeData) { $nodeIdentifiers[] = $nodeIdentifier->getIdentifier(); } elseif (preg_match(NodeIdentifierValidator::PATTERN_MATCH_NODE_IDENTIFIER, $nodeIdentifier) !== 0) { $nodeIdentifiers[] = $nodeIdentifier; } } } $value = $nodeIdentifiers; break; case 'reference': $nodeIdentifier = null; if ($value instanceof NodeInterface || $value instanceof AbstractNodeData) { $nodeIdentifier = $value->getIdentifier(); } elseif (preg_match(NodeIdentifierValidator::PATTERN_MATCH_NODE_IDENTIFIER, $value) !== 0) { $nodeIdentifier = $value; } $value = $nodeIdentifier; break; } $this->persistRelatedEntities($value); if (array_key_exists($propertyName, $this->properties) && $this->properties[$propertyName] === $value) { return; } $this->properties[$propertyName] = $value; $this->addOrUpdate(); } elseif (ObjectAccess::isPropertySettable($this->contentObjectProxy->getObject(), $propertyName)) { $contentObject = $this->contentObjectProxy->getObject(); ObjectAccess::setProperty($contentObject, $propertyName, $value); $this->updateContentObject($contentObject); } }
php
public function setProperty($propertyName, $value) { if (!is_object($this->contentObjectProxy)) { switch ($this->getNodeType()->getPropertyType($propertyName)) { case 'references': $nodeIdentifiers = []; if (is_array($value)) { foreach ($value as $nodeIdentifier) { if ($nodeIdentifier instanceof NodeInterface || $nodeIdentifier instanceof AbstractNodeData) { $nodeIdentifiers[] = $nodeIdentifier->getIdentifier(); } elseif (preg_match(NodeIdentifierValidator::PATTERN_MATCH_NODE_IDENTIFIER, $nodeIdentifier) !== 0) { $nodeIdentifiers[] = $nodeIdentifier; } } } $value = $nodeIdentifiers; break; case 'reference': $nodeIdentifier = null; if ($value instanceof NodeInterface || $value instanceof AbstractNodeData) { $nodeIdentifier = $value->getIdentifier(); } elseif (preg_match(NodeIdentifierValidator::PATTERN_MATCH_NODE_IDENTIFIER, $value) !== 0) { $nodeIdentifier = $value; } $value = $nodeIdentifier; break; } $this->persistRelatedEntities($value); if (array_key_exists($propertyName, $this->properties) && $this->properties[$propertyName] === $value) { return; } $this->properties[$propertyName] = $value; $this->addOrUpdate(); } elseif (ObjectAccess::isPropertySettable($this->contentObjectProxy->getObject(), $propertyName)) { $contentObject = $this->contentObjectProxy->getObject(); ObjectAccess::setProperty($contentObject, $propertyName, $value); $this->updateContentObject($contentObject); } }
[ "public", "function", "setProperty", "(", "$", "propertyName", ",", "$", "value", ")", "{", "if", "(", "!", "is_object", "(", "$", "this", "->", "contentObjectProxy", ")", ")", "{", "switch", "(", "$", "this", "->", "getNodeType", "(", ")", "->", "getP...
Sets the specified property. If the node has a content object attached, the property will be set there if it is settable. @param string $propertyName Name of the property @param mixed $value Value of the property @return void
[ "Sets", "the", "specified", "property", ".", "If", "the", "node", "has", "a", "content", "object", "attached", "the", "property", "will", "be", "set", "there", "if", "it", "is", "settable", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/AbstractNodeData.php#L163-L205
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/AbstractNodeData.php
AbstractNodeData.persistRelatedEntities
protected function persistRelatedEntities($value) { if (!is_array($value) && !$value instanceof \Iterator) { $value = [$value]; } foreach ($value as $element) { if (is_object($element) && $element instanceof PersistenceMagicInterface) { $this->persistenceManager->isNewObject($element) ? $this->persistenceManager->add($element) : $this->persistenceManager->update($element); } } }
php
protected function persistRelatedEntities($value) { if (!is_array($value) && !$value instanceof \Iterator) { $value = [$value]; } foreach ($value as $element) { if (is_object($element) && $element instanceof PersistenceMagicInterface) { $this->persistenceManager->isNewObject($element) ? $this->persistenceManager->add($element) : $this->persistenceManager->update($element); } } }
[ "protected", "function", "persistRelatedEntities", "(", "$", "value", ")", "{", "if", "(", "!", "is_array", "(", "$", "value", ")", "&&", "!", "$", "value", "instanceof", "\\", "Iterator", ")", "{", "$", "value", "=", "[", "$", "value", "]", ";", "}"...
Checks if a property value contains an entity and persists it. @param mixed $value
[ "Checks", "if", "a", "property", "value", "contains", "an", "entity", "and", "persists", "it", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/AbstractNodeData.php#L212-L222
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/AbstractNodeData.php
AbstractNodeData.hasProperty
public function hasProperty($propertyName) { if (is_object($this->contentObjectProxy)) { return ObjectAccess::isPropertyGettable($this->contentObjectProxy->getObject(), $propertyName); } return array_key_exists($propertyName, $this->properties); }
php
public function hasProperty($propertyName) { if (is_object($this->contentObjectProxy)) { return ObjectAccess::isPropertyGettable($this->contentObjectProxy->getObject(), $propertyName); } return array_key_exists($propertyName, $this->properties); }
[ "public", "function", "hasProperty", "(", "$", "propertyName", ")", "{", "if", "(", "is_object", "(", "$", "this", "->", "contentObjectProxy", ")", ")", "{", "return", "ObjectAccess", "::", "isPropertyGettable", "(", "$", "this", "->", "contentObjectProxy", "-...
If this node has a property with the given name. If the node has a content object attached, the property will be checked there. @param string $propertyName Name of the property to test for @return boolean
[ "If", "this", "node", "has", "a", "property", "with", "the", "given", "name", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/AbstractNodeData.php#L233-L239
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/AbstractNodeData.php
AbstractNodeData.getPropertyNames
public function getPropertyNames() { if (is_object($this->contentObjectProxy)) { return ObjectAccess::getGettablePropertyNames($this->contentObjectProxy->getObject()); } return array_keys($this->properties); }
php
public function getPropertyNames() { if (is_object($this->contentObjectProxy)) { return ObjectAccess::getGettablePropertyNames($this->contentObjectProxy->getObject()); } return array_keys($this->properties); }
[ "public", "function", "getPropertyNames", "(", ")", "{", "if", "(", "is_object", "(", "$", "this", "->", "contentObjectProxy", ")", ")", "{", "return", "ObjectAccess", "::", "getGettablePropertyNames", "(", "$", "this", "->", "contentObjectProxy", "->", "getObje...
Returns the names of all properties of this node. @return array Property names
[ "Returns", "the", "names", "of", "all", "properties", "of", "this", "node", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/AbstractNodeData.php#L317-L323
train
neos/neos-development-collection
Neos.Neos/Classes/ViewHelpers/Uri/ModuleViewHelper.php
ModuleViewHelper.setMainRequestToUriBuilder
protected function setMainRequestToUriBuilder() { $mainRequest = $this->controllerContext->getRequest()->getMainRequest(); $this->uriBuilder->setRequest($mainRequest); }
php
protected function setMainRequestToUriBuilder() { $mainRequest = $this->controllerContext->getRequest()->getMainRequest(); $this->uriBuilder->setRequest($mainRequest); }
[ "protected", "function", "setMainRequestToUriBuilder", "(", ")", "{", "$", "mainRequest", "=", "$", "this", "->", "controllerContext", "->", "getRequest", "(", ")", "->", "getMainRequest", "(", ")", ";", "$", "this", "->", "uriBuilder", "->", "setRequest", "("...
Extracted out to this method in order to be better unit-testable. @return void
[ "Extracted", "out", "to", "this", "method", "in", "order", "to", "be", "better", "unit", "-", "testable", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/ViewHelpers/Uri/ModuleViewHelper.php#L86-L90
train
neos/neos-development-collection
Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php
ContentCacheFlusher.registerNodeChange
public function registerNodeChange(NodeInterface $node, Workspace $targetWorkspace = null): void { $this->tagsToFlush[ContentCache::TAG_EVERYTHING] = 'which were tagged with "Everything".'; if (empty($this->workspacesToFlush[$node->getWorkspace()->getName()])) { $this->resolveWorkspaceChain($node->getWorkspace()); } if ($targetWorkspace !== null && empty($this->workspacesToFlush[$targetWorkspace->getName()])) { $this->resolveWorkspaceChain($targetWorkspace); } if (!array_key_exists($node->getWorkspace()->getName(), $this->workspacesToFlush)) { return; } $this->registerAllTagsToFlushForNodeInWorkspace($node, $node->getWorkspace()); if ($targetWorkspace !== null) { $this->registerAllTagsToFlushForNodeInWorkspace($node, $targetWorkspace); } }
php
public function registerNodeChange(NodeInterface $node, Workspace $targetWorkspace = null): void { $this->tagsToFlush[ContentCache::TAG_EVERYTHING] = 'which were tagged with "Everything".'; if (empty($this->workspacesToFlush[$node->getWorkspace()->getName()])) { $this->resolveWorkspaceChain($node->getWorkspace()); } if ($targetWorkspace !== null && empty($this->workspacesToFlush[$targetWorkspace->getName()])) { $this->resolveWorkspaceChain($targetWorkspace); } if (!array_key_exists($node->getWorkspace()->getName(), $this->workspacesToFlush)) { return; } $this->registerAllTagsToFlushForNodeInWorkspace($node, $node->getWorkspace()); if ($targetWorkspace !== null) { $this->registerAllTagsToFlushForNodeInWorkspace($node, $targetWorkspace); } }
[ "public", "function", "registerNodeChange", "(", "NodeInterface", "$", "node", ",", "Workspace", "$", "targetWorkspace", "=", "null", ")", ":", "void", "{", "$", "this", "->", "tagsToFlush", "[", "ContentCache", "::", "TAG_EVERYTHING", "]", "=", "'which were tag...
Register a node change for a later cache flush. This method is triggered by a signal sent via ContentRepository's Node model or the Neos Publishing Service. @param NodeInterface $node The node which has changed in some way @param Workspace $targetWorkspace An optional workspace to flush @return void @throws \Neos\ContentRepository\Exception\NodeTypeNotFoundException
[ "Register", "a", "node", "change", "for", "a", "later", "cache", "flush", ".", "This", "method", "is", "triggered", "by", "a", "signal", "sent", "via", "ContentRepository", "s", "Node", "model", "or", "the", "Neos", "Publishing", "Service", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php#L99-L119
train
neos/neos-development-collection
Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php
ContentCacheFlusher.registerAssetChange
public function registerAssetChange(AssetInterface $asset) { if (!$asset->isInUse()) { return; } $cachingHelper = $this->getCachingHelper(); foreach ($this->assetService->getUsageReferences($asset) as $reference) { if (!$reference instanceof AssetUsageInNodeProperties) { continue; } $workspaceHash = $cachingHelper->renderWorkspaceTagForContextNode($reference->getWorkspaceName()); $this->registerChangeOnNodeIdentifier($workspaceHash . '_' . $reference->getNodeIdentifier()); $this->registerChangeOnNodeType($reference->getNodeTypeName(), $reference->getNodeIdentifier(), $workspaceHash); $assetIdentifier = $this->persistenceManager->getIdentifierByObject($asset); $tagName = 'AssetDynamicTag_' . $workspaceHash . '_' . $assetIdentifier; $this->tagsToFlush[$tagName] = sprintf('which were tagged with "%s" because asset "%s" has changed.', $tagName, $assetIdentifier); } }
php
public function registerAssetChange(AssetInterface $asset) { if (!$asset->isInUse()) { return; } $cachingHelper = $this->getCachingHelper(); foreach ($this->assetService->getUsageReferences($asset) as $reference) { if (!$reference instanceof AssetUsageInNodeProperties) { continue; } $workspaceHash = $cachingHelper->renderWorkspaceTagForContextNode($reference->getWorkspaceName()); $this->registerChangeOnNodeIdentifier($workspaceHash . '_' . $reference->getNodeIdentifier()); $this->registerChangeOnNodeType($reference->getNodeTypeName(), $reference->getNodeIdentifier(), $workspaceHash); $assetIdentifier = $this->persistenceManager->getIdentifierByObject($asset); $tagName = 'AssetDynamicTag_' . $workspaceHash . '_' . $assetIdentifier; $this->tagsToFlush[$tagName] = sprintf('which were tagged with "%s" because asset "%s" has changed.', $tagName, $assetIdentifier); } }
[ "public", "function", "registerAssetChange", "(", "AssetInterface", "$", "asset", ")", "{", "if", "(", "!", "$", "asset", "->", "isInUse", "(", ")", ")", "{", "return", ";", "}", "$", "cachingHelper", "=", "$", "this", "->", "getCachingHelper", "(", ")",...
Fetches possible usages of the asset and registers nodes that use the asset as changed. @param AssetInterface $asset @return void
[ "Fetches", "possible", "usages", "of", "the", "asset", "and", "registers", "nodes", "that", "use", "the", "asset", "as", "changed", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php#L248-L271
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/Asset.php
Asset.getThumbnail
public function getThumbnail($maximumWidth = null, $maximumHeight = null, $ratioMode = ImageInterface::RATIOMODE_INSET, $allowUpScaling = null) { $thumbnailConfiguration = new ThumbnailConfiguration(null, $maximumWidth, null, $maximumHeight, $ratioMode === ImageInterface::RATIOMODE_OUTBOUND, $allowUpScaling); return $this->thumbnailService->getThumbnail($this, $thumbnailConfiguration); }
php
public function getThumbnail($maximumWidth = null, $maximumHeight = null, $ratioMode = ImageInterface::RATIOMODE_INSET, $allowUpScaling = null) { $thumbnailConfiguration = new ThumbnailConfiguration(null, $maximumWidth, null, $maximumHeight, $ratioMode === ImageInterface::RATIOMODE_OUTBOUND, $allowUpScaling); return $this->thumbnailService->getThumbnail($this, $thumbnailConfiguration); }
[ "public", "function", "getThumbnail", "(", "$", "maximumWidth", "=", "null", ",", "$", "maximumHeight", "=", "null", ",", "$", "ratioMode", "=", "ImageInterface", "::", "RATIOMODE_INSET", ",", "$", "allowUpScaling", "=", "null", ")", "{", "$", "thumbnailConfig...
Returns a thumbnail of this asset If the maximum width / height is not specified or exceeds the original asset's dimensions, the width / height of the original asset is used. @param integer $maximumWidth The thumbnail's maximum width in pixels @param integer $maximumHeight The thumbnail's maximum height in pixels @param string $ratioMode Whether the resulting image should be cropped if both edge's sizes are supplied that would hurt the aspect ratio @param boolean $allowUpScaling Whether the resulting image should be upscaled @return Thumbnail @throws \Exception @api @throws \Exception
[ "Returns", "a", "thumbnail", "of", "this", "asset" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/Asset.php#L364-L368
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/Asset.php
Asset.refresh
public function refresh() { $assetClassType = str_replace('Neos\Media\Domain\Model\\', '', get_class($this)); $this->systemLogger->debug(sprintf('%s: refresh() called, clearing all thumbnails. Filename: %s. PersistentResource SHA1: %s', $assetClassType, $this->getResource()->getFilename(), $this->getResource()->getSha1())); // whitelist objects so they can be deleted (even during safe requests) $this->persistenceManager->whitelistObject($this); foreach ($this->thumbnails as $thumbnail) { $this->persistenceManager->whitelistObject($thumbnail); } $this->thumbnails->clear(); }
php
public function refresh() { $assetClassType = str_replace('Neos\Media\Domain\Model\\', '', get_class($this)); $this->systemLogger->debug(sprintf('%s: refresh() called, clearing all thumbnails. Filename: %s. PersistentResource SHA1: %s', $assetClassType, $this->getResource()->getFilename(), $this->getResource()->getSha1())); // whitelist objects so they can be deleted (even during safe requests) $this->persistenceManager->whitelistObject($this); foreach ($this->thumbnails as $thumbnail) { $this->persistenceManager->whitelistObject($thumbnail); } $this->thumbnails->clear(); }
[ "public", "function", "refresh", "(", ")", "{", "$", "assetClassType", "=", "str_replace", "(", "'Neos\\Media\\Domain\\Model\\\\'", ",", "''", ",", "get_class", "(", "$", "this", ")", ")", ";", "$", "this", "->", "systemLogger", "->", "debug", "(", "sprintf"...
Refreshes this asset after the Resource or any other parameters affecting thumbnails have been modified @return void
[ "Refreshes", "this", "asset", "after", "the", "Resource", "or", "any", "other", "parameters", "affecting", "thumbnails", "have", "been", "modified" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/Asset.php#L387-L399
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/Asset.php
Asset.setAssetCollections
public function setAssetCollections(Collection $assetCollections) { $this->lastModified = new \DateTime(); foreach ($this->assetCollections as $existingAssetCollection) { $existingAssetCollection->removeAsset($this); } foreach ($assetCollections as $newAssetCollection) { $newAssetCollection->addAsset($this); } foreach ($this->assetCollections as $assetCollection) { if (!$assetCollections->contains($assetCollection)) { $assetCollections->add($assetCollection); } } $this->assetCollections = $assetCollections; }
php
public function setAssetCollections(Collection $assetCollections) { $this->lastModified = new \DateTime(); foreach ($this->assetCollections as $existingAssetCollection) { $existingAssetCollection->removeAsset($this); } foreach ($assetCollections as $newAssetCollection) { $newAssetCollection->addAsset($this); } foreach ($this->assetCollections as $assetCollection) { if (!$assetCollections->contains($assetCollection)) { $assetCollections->add($assetCollection); } } $this->assetCollections = $assetCollections; }
[ "public", "function", "setAssetCollections", "(", "Collection", "$", "assetCollections", ")", "{", "$", "this", "->", "lastModified", "=", "new", "\\", "DateTime", "(", ")", ";", "foreach", "(", "$", "this", "->", "assetCollections", "as", "$", "existingAssetC...
Set the asset collections that include this asset @param Collection $assetCollections @return void
[ "Set", "the", "asset", "collections", "that", "include", "this", "asset" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/Asset.php#L447-L462
train
neos/neos-development-collection
Neos.Neos/Classes/Service/Controller/NodeController.php
NodeController.initializeAction
protected function initializeAction() { if ($this->arguments->hasArgument('referenceNode')) { $this->arguments->getArgument('referenceNode')->getPropertyMappingConfiguration()->setTypeConverterOption(NodeConverter::class, NodeConverter::REMOVED_CONTENT_SHOWN, true); } $this->uriBuilder->setRequest($this->request->getMainRequest()); if (in_array($this->request->getControllerActionName(), ['update', 'updateAndRender'], true)) { // Set PropertyMappingConfiguration for updating the node (and attached objects) $propertyMappingConfiguration = $this->arguments->getArgument('node')->getPropertyMappingConfiguration(); $propertyMappingConfiguration->allowOverrideTargetType(); $propertyMappingConfiguration->allowAllProperties(); $propertyMappingConfiguration->skipUnknownProperties(); $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED, true); $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); } }
php
protected function initializeAction() { if ($this->arguments->hasArgument('referenceNode')) { $this->arguments->getArgument('referenceNode')->getPropertyMappingConfiguration()->setTypeConverterOption(NodeConverter::class, NodeConverter::REMOVED_CONTENT_SHOWN, true); } $this->uriBuilder->setRequest($this->request->getMainRequest()); if (in_array($this->request->getControllerActionName(), ['update', 'updateAndRender'], true)) { // Set PropertyMappingConfiguration for updating the node (and attached objects) $propertyMappingConfiguration = $this->arguments->getArgument('node')->getPropertyMappingConfiguration(); $propertyMappingConfiguration->allowOverrideTargetType(); $propertyMappingConfiguration->allowAllProperties(); $propertyMappingConfiguration->skipUnknownProperties(); $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED, true); $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); } }
[ "protected", "function", "initializeAction", "(", ")", "{", "if", "(", "$", "this", "->", "arguments", "->", "hasArgument", "(", "'referenceNode'", ")", ")", "{", "$", "this", "->", "arguments", "->", "getArgument", "(", "'referenceNode'", ")", "->", "getPro...
Select special error action @return void
[ "Select", "special", "error", "action" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L107-L122
train
neos/neos-development-collection
Neos.Neos/Classes/Service/Controller/NodeController.php
NodeController.getChildNodesForTreeAction
public function getChildNodesForTreeAction(Node $node, $nodeTypeFilter, $depth, Node $untilNode) { $this->view->assignChildNodes($node, $nodeTypeFilter, NodeView::STYLE_TREE, $depth, $untilNode); }
php
public function getChildNodesForTreeAction(Node $node, $nodeTypeFilter, $depth, Node $untilNode) { $this->view->assignChildNodes($node, $nodeTypeFilter, NodeView::STYLE_TREE, $depth, $untilNode); }
[ "public", "function", "getChildNodesForTreeAction", "(", "Node", "$", "node", ",", "$", "nodeTypeFilter", ",", "$", "depth", ",", "Node", "$", "untilNode", ")", "{", "$", "this", "->", "view", "->", "assignChildNodes", "(", "$", "node", ",", "$", "nodeType...
Return child nodes of specified node for usage in a TreeLoader @param Node $node The node to find child nodes for @param string $nodeTypeFilter A node type filter @param integer $depth levels of childNodes (0 = unlimited) @param Node $untilNode expand the child nodes until $untilNode is reached, independent of $depth @return void
[ "Return", "child", "nodes", "of", "specified", "node", "for", "usage", "in", "a", "TreeLoader" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L137-L140
train
neos/neos-development-collection
Neos.Neos/Classes/Service/Controller/NodeController.php
NodeController.filterChildNodesForTreeAction
public function filterChildNodesForTreeAction(Node $node, $term, $nodeType) { $nodeTypes = strlen($nodeType) > 0 ? [$nodeType] : array_keys($this->nodeTypeManager->getSubNodeTypes('Neos.Neos:Document', false)); $context = $node->getContext(); if ($term !== '') { $nodes = $this->nodeSearchService->findByProperties($term, $nodeTypes, $context, $node); } else { $nodes = []; $nodeDataRecords = $this->nodeDataRepository->findByParentAndNodeTypeRecursively($node->getPath(), implode(',', $nodeTypes), $context->getWorkspace(), $context->getDimensions()); foreach ($nodeDataRecords as $nodeData) { $matchedNode = $this->nodeFactory->createFromNodeData($nodeData, $context); if ($matchedNode !== null) { $nodes[$matchedNode->getPath()] = $matchedNode; } } } $this->view->assignFilteredChildNodes( $node, $nodes ); }
php
public function filterChildNodesForTreeAction(Node $node, $term, $nodeType) { $nodeTypes = strlen($nodeType) > 0 ? [$nodeType] : array_keys($this->nodeTypeManager->getSubNodeTypes('Neos.Neos:Document', false)); $context = $node->getContext(); if ($term !== '') { $nodes = $this->nodeSearchService->findByProperties($term, $nodeTypes, $context, $node); } else { $nodes = []; $nodeDataRecords = $this->nodeDataRepository->findByParentAndNodeTypeRecursively($node->getPath(), implode(',', $nodeTypes), $context->getWorkspace(), $context->getDimensions()); foreach ($nodeDataRecords as $nodeData) { $matchedNode = $this->nodeFactory->createFromNodeData($nodeData, $context); if ($matchedNode !== null) { $nodes[$matchedNode->getPath()] = $matchedNode; } } } $this->view->assignFilteredChildNodes( $node, $nodes ); }
[ "public", "function", "filterChildNodesForTreeAction", "(", "Node", "$", "node", ",", "$", "term", ",", "$", "nodeType", ")", "{", "$", "nodeTypes", "=", "strlen", "(", "$", "nodeType", ")", ">", "0", "?", "[", "$", "nodeType", "]", ":", "array_keys", ...
Return child nodes of specified node for usage in a TreeLoader based on filter @param Node $node The node to find child nodes for @param string $term @param string $nodeType @return void
[ "Return", "child", "nodes", "of", "specified", "node", "for", "usage", "in", "a", "TreeLoader", "based", "on", "filter" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L150-L170
train
neos/neos-development-collection
Neos.Neos/Classes/Service/Controller/NodeController.php
NodeController.createAction
public function createAction(Node $referenceNode, array $nodeData, $position) { $newNode = $this->nodeOperations->create($referenceNode, $nodeData, $position); if ($this->request->getHttpRequest()->isMethodSafe() === false) { $this->persistenceManager->persistAll(); } $nextUri = $this->uriBuilder->reset()->setFormat('html')->setCreateAbsoluteUri(true)->uriFor('show', ['node' => $newNode], 'Frontend\Node', 'Neos.Neos'); $this->view->assign('value', ['data' => ['nextUri' => $nextUri], 'success' => true]); }
php
public function createAction(Node $referenceNode, array $nodeData, $position) { $newNode = $this->nodeOperations->create($referenceNode, $nodeData, $position); if ($this->request->getHttpRequest()->isMethodSafe() === false) { $this->persistenceManager->persistAll(); } $nextUri = $this->uriBuilder->reset()->setFormat('html')->setCreateAbsoluteUri(true)->uriFor('show', ['node' => $newNode], 'Frontend\Node', 'Neos.Neos'); $this->view->assign('value', ['data' => ['nextUri' => $nextUri], 'success' => true]); }
[ "public", "function", "createAction", "(", "Node", "$", "referenceNode", ",", "array", "$", "nodeData", ",", "$", "position", ")", "{", "$", "newNode", "=", "$", "this", "->", "nodeOperations", "->", "create", "(", "$", "referenceNode", ",", "$", "nodeData...
Creates a new node 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 $referenceNode @param array $nodeData @param string $position where the node should be added (allowed: before, into, after) @return void
[ "Creates", "a", "new", "node" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/Controller/NodeController.php#L183-L193
train