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/Fusion/ContentElementWrappingImplementation.php
ContentElementWrappingImplementation.getContentElementFusionPath
protected function getContentElementFusionPath() { $fusionPathSegments = explode('/', $this->path); $numberOfFusionPathSegments = count($fusionPathSegments); if (isset($fusionPathSegments[$numberOfFusionPathSegments - 3]) && $fusionPathSegments[$numberOfFusionPathSegments - 3] === '__meta' && isset($fusionPathSegments[$numberOfFusionPathSegments - 2]) && $fusionPathSegments[$numberOfFusionPathSegments - 2] === 'process') { // cut off the SHORT processing syntax "__meta/process/contentElementWrapping<Neos.Neos:ContentElementWrapping>" return implode('/', array_slice($fusionPathSegments, 0, -3)); } if (isset($fusionPathSegments[$numberOfFusionPathSegments - 4]) && $fusionPathSegments[$numberOfFusionPathSegments - 4] === '__meta' && isset($fusionPathSegments[$numberOfFusionPathSegments - 3]) && $fusionPathSegments[$numberOfFusionPathSegments - 3] === 'process') { // cut off the LONG processing syntax "__meta/process/contentElementWrapping/expression<Neos.Neos:ContentElementWrapping>" return implode('/', array_slice($fusionPathSegments, 0, -4)); } return $this->path; }
php
protected function getContentElementFusionPath() { $fusionPathSegments = explode('/', $this->path); $numberOfFusionPathSegments = count($fusionPathSegments); if (isset($fusionPathSegments[$numberOfFusionPathSegments - 3]) && $fusionPathSegments[$numberOfFusionPathSegments - 3] === '__meta' && isset($fusionPathSegments[$numberOfFusionPathSegments - 2]) && $fusionPathSegments[$numberOfFusionPathSegments - 2] === 'process') { // cut off the SHORT processing syntax "__meta/process/contentElementWrapping<Neos.Neos:ContentElementWrapping>" return implode('/', array_slice($fusionPathSegments, 0, -3)); } if (isset($fusionPathSegments[$numberOfFusionPathSegments - 4]) && $fusionPathSegments[$numberOfFusionPathSegments - 4] === '__meta' && isset($fusionPathSegments[$numberOfFusionPathSegments - 3]) && $fusionPathSegments[$numberOfFusionPathSegments - 3] === 'process') { // cut off the LONG processing syntax "__meta/process/contentElementWrapping/expression<Neos.Neos:ContentElementWrapping>" return implode('/', array_slice($fusionPathSegments, 0, -4)); } return $this->path; }
[ "protected", "function", "getContentElementFusionPath", "(", ")", "{", "$", "fusionPathSegments", "=", "explode", "(", "'/'", ",", "$", "this", "->", "path", ")", ";", "$", "numberOfFusionPathSegments", "=", "count", "(", "$", "fusionPathSegments", ")", ";", "...
Returns the Fusion path to the wrapped Content Element @return string
[ "Returns", "the", "Fusion", "path", "to", "the", "wrapped", "Content", "Element" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php#L99-L121
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Cache/ContentCache.php
ContentCache.createCacheSegment
public function createCacheSegment($content, $fusionPath, array $cacheIdentifierValues, array $tags = [], $lifetime = null) { $cacheIdentifier = $this->renderContentCacheEntryIdentifier($fusionPath, $cacheIdentifierValues); $metadata = implode(',', $tags); if ($lifetime !== null) { $metadata .= ';' . $lifetime; } return self::CACHE_SEGMENT_START_TOKEN . $this->randomCacheMarker . $cacheIdentifier . self::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $metadata . self::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $content . self::CACHE_SEGMENT_END_TOKEN . $this->randomCacheMarker; }
php
public function createCacheSegment($content, $fusionPath, array $cacheIdentifierValues, array $tags = [], $lifetime = null) { $cacheIdentifier = $this->renderContentCacheEntryIdentifier($fusionPath, $cacheIdentifierValues); $metadata = implode(',', $tags); if ($lifetime !== null) { $metadata .= ';' . $lifetime; } return self::CACHE_SEGMENT_START_TOKEN . $this->randomCacheMarker . $cacheIdentifier . self::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $metadata . self::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $content . self::CACHE_SEGMENT_END_TOKEN . $this->randomCacheMarker; }
[ "public", "function", "createCacheSegment", "(", "$", "content", ",", "$", "fusionPath", ",", "array", "$", "cacheIdentifierValues", ",", "array", "$", "tags", "=", "[", "]", ",", "$", "lifetime", "=", "null", ")", "{", "$", "cacheIdentifier", "=", "$", ...
Takes the given content and adds markers for later use as a cached content segment. This function will add a start and an end token to the beginning and end of the content and generate a cache identifier based on the current Fusion path and additional values which were defined in the Fusion configuration by the site integrator. The whole cache segment (START TOKEN + IDENTIFIER + SEPARATOR TOKEN + original content + END TOKEN) is returned as a string. This method is called by the Fusion Runtime while rendering a Fusion object. @param string $content The (partial) content which should potentially be cached later on @param string $fusionPath The Fusion path that rendered the content, for example "page<Neos.NodeTypes:Page>/body<Acme.Demo:DefaultPageTemplate>/parts/breadcrumbMenu" @param array $cacheIdentifierValues The values (simple type or implementing CacheAwareInterface) that should be used to create a cache identifier, will be sorted by keys for consistent ordering @param array $tags Tags to add to the cache entry @param integer $lifetime Lifetime of the cache segment in seconds. NULL for the default lifetime and 0 for unlimited lifetime. @return string The original content, but with additional markers and a cache identifier added
[ "Takes", "the", "given", "content", "and", "adds", "markers", "for", "later", "use", "as", "a", "cached", "content", "segment", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Cache/ContentCache.php#L118-L126
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Cache/ContentCache.php
ContentCache.renderContentCacheEntryIdentifier
protected function renderContentCacheEntryIdentifier($fusionPath, array $cacheIdentifierValues) { ksort($cacheIdentifierValues); $identifierSource = ''; foreach ($cacheIdentifierValues as $key => $value) { if ($value instanceof CacheAwareInterface) { $identifierSource .= $key . '=' . $value->getCacheEntryIdentifier() . '&'; } elseif (is_string($value) || is_bool($value) || is_integer($value)) { $identifierSource .= $key . '=' . $value . '&'; } elseif ($value !== null) { throw new CacheException(sprintf('Invalid cache entry identifier @cache.entryIdentifier.%s for path "%s". A entry identifier value must be a string or implement CacheAwareInterface.', $key, $fusionPath), 1395846615); } } $identifierSource .= 'securityContextHash=' . $this->securityContext->getContextHash(); return md5($fusionPath . '@' . $identifierSource); }
php
protected function renderContentCacheEntryIdentifier($fusionPath, array $cacheIdentifierValues) { ksort($cacheIdentifierValues); $identifierSource = ''; foreach ($cacheIdentifierValues as $key => $value) { if ($value instanceof CacheAwareInterface) { $identifierSource .= $key . '=' . $value->getCacheEntryIdentifier() . '&'; } elseif (is_string($value) || is_bool($value) || is_integer($value)) { $identifierSource .= $key . '=' . $value . '&'; } elseif ($value !== null) { throw new CacheException(sprintf('Invalid cache entry identifier @cache.entryIdentifier.%s for path "%s". A entry identifier value must be a string or implement CacheAwareInterface.', $key, $fusionPath), 1395846615); } } $identifierSource .= 'securityContextHash=' . $this->securityContext->getContextHash(); return md5($fusionPath . '@' . $identifierSource); }
[ "protected", "function", "renderContentCacheEntryIdentifier", "(", "$", "fusionPath", ",", "array", "$", "cacheIdentifierValues", ")", "{", "ksort", "(", "$", "cacheIdentifierValues", ")", ";", "$", "identifierSource", "=", "''", ";", "foreach", "(", "$", "cacheId...
Renders an identifier for a content cache entry @param string $fusionPath @param array $cacheIdentifierValues @return string An MD5 hash built from the fusionPath and certain elements of the given identifier values @throws CacheException If an invalid entry identifier value is given
[ "Renders", "an", "identifier", "for", "a", "content", "cache", "entry" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Cache/ContentCache.php#L185-L202
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Cache/ContentCache.php
ContentCache.processCacheSegments
public function processCacheSegments($content, $storeCacheEntries = true) { $parser = new CacheSegmentParser($content, $this->randomCacheMarker); if ($storeCacheEntries) { $segments = $parser->getCacheSegments(); foreach ($segments as $segment) { $metadata = explode(';', $segment['metadata']); $tagsValue = $metadata[0] === '' ? [] : ($metadata[0] === '*' ? false : explode(',', $metadata[0])); // false means we do not need to store the cache entry again (because it was previously fetched) if ($tagsValue !== false) { $lifetime = isset($metadata[1]) ? (integer)$metadata[1] : null; $this->cache->set($segment['identifier'], $segment['content'], $this->sanitizeTags($tagsValue), $lifetime); } } } return $parser->getOutput(); }
php
public function processCacheSegments($content, $storeCacheEntries = true) { $parser = new CacheSegmentParser($content, $this->randomCacheMarker); if ($storeCacheEntries) { $segments = $parser->getCacheSegments(); foreach ($segments as $segment) { $metadata = explode(';', $segment['metadata']); $tagsValue = $metadata[0] === '' ? [] : ($metadata[0] === '*' ? false : explode(',', $metadata[0])); // false means we do not need to store the cache entry again (because it was previously fetched) if ($tagsValue !== false) { $lifetime = isset($metadata[1]) ? (integer)$metadata[1] : null; $this->cache->set($segment['identifier'], $segment['content'], $this->sanitizeTags($tagsValue), $lifetime); } } } return $parser->getOutput(); }
[ "public", "function", "processCacheSegments", "(", "$", "content", ",", "$", "storeCacheEntries", "=", "true", ")", "{", "$", "parser", "=", "new", "CacheSegmentParser", "(", "$", "content", ",", "$", "this", "->", "randomCacheMarker", ")", ";", "if", "(", ...
Takes a string of content which includes cache segment markers, extracts the marked segments, writes those segments which can be cached to the actual cache and returns the cleaned up original content without markers. This method is called by the Fusion Runtime while rendering a Fusion object. @param string $content The content with an outer cache segment @param boolean $storeCacheEntries Whether to store extracted cache segments in the cache @return string The (pure) content without cache segment markers
[ "Takes", "a", "string", "of", "content", "which", "includes", "cache", "segment", "markers", "extracts", "the", "marked", "segments", "writes", "those", "segments", "which", "can", "be", "cached", "to", "the", "actual", "cache", "and", "returns", "the", "clean...
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Cache/ContentCache.php#L214-L233
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Cache/ContentCache.php
ContentCache.replaceCachePlaceholders
protected function replaceCachePlaceholders(&$content, $addCacheSegmentMarkersToPlaceholders) { $cache = $this->cache; $foundMissingIdentifier = false; $content = preg_replace_callback(self::CACHE_PLACEHOLDER_REGEX, function ($match) use ($cache, &$foundMissingIdentifier, $addCacheSegmentMarkersToPlaceholders) { $identifier = $match['identifier']; $entry = $cache->get($identifier); if ($entry !== false) { if ($addCacheSegmentMarkersToPlaceholders) { return ContentCache::CACHE_SEGMENT_START_TOKEN . $this->randomCacheMarker . $identifier . ContentCache::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . '*' . ContentCache::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $entry . ContentCache::CACHE_SEGMENT_END_TOKEN . $this->randomCacheMarker; } else { return $entry; } } else { $foundMissingIdentifier = true; return ''; } }, $content, -1, $count); if ($foundMissingIdentifier) { return false; } return $count; }
php
protected function replaceCachePlaceholders(&$content, $addCacheSegmentMarkersToPlaceholders) { $cache = $this->cache; $foundMissingIdentifier = false; $content = preg_replace_callback(self::CACHE_PLACEHOLDER_REGEX, function ($match) use ($cache, &$foundMissingIdentifier, $addCacheSegmentMarkersToPlaceholders) { $identifier = $match['identifier']; $entry = $cache->get($identifier); if ($entry !== false) { if ($addCacheSegmentMarkersToPlaceholders) { return ContentCache::CACHE_SEGMENT_START_TOKEN . $this->randomCacheMarker . $identifier . ContentCache::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . '*' . ContentCache::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $entry . ContentCache::CACHE_SEGMENT_END_TOKEN . $this->randomCacheMarker; } else { return $entry; } } else { $foundMissingIdentifier = true; return ''; } }, $content, -1, $count); if ($foundMissingIdentifier) { return false; } return $count; }
[ "protected", "function", "replaceCachePlaceholders", "(", "&", "$", "content", ",", "$", "addCacheSegmentMarkersToPlaceholders", ")", "{", "$", "cache", "=", "$", "this", "->", "cache", ";", "$", "foundMissingIdentifier", "=", "false", ";", "$", "content", "=", ...
Find cache placeholders in a cached segment and return the identifiers @param string $content @param boolean $addCacheSegmentMarkersToPlaceholders @return integer|boolean Number of replaced placeholders or false if a placeholder couldn't be found
[ "Find", "cache", "placeholders", "in", "a", "cached", "segment", "and", "return", "the", "identifiers" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Cache/ContentCache.php#L290-L312
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Cache/ContentCache.php
ContentCache.replaceUncachedPlaceholders
protected function replaceUncachedPlaceholders(\Closure $uncachedCommandCallback, &$content) { $cache = $this->cache; $content = preg_replace_callback(self::EVAL_PLACEHOLDER_REGEX, function ($match) use ($uncachedCommandCallback, $cache) { $command = $match['command']; $additionalData = json_decode($match['data'], true); return $uncachedCommandCallback($command, $additionalData, $cache); }, $content, -1, $count); return $count; }
php
protected function replaceUncachedPlaceholders(\Closure $uncachedCommandCallback, &$content) { $cache = $this->cache; $content = preg_replace_callback(self::EVAL_PLACEHOLDER_REGEX, function ($match) use ($uncachedCommandCallback, $cache) { $command = $match['command']; $additionalData = json_decode($match['data'], true); return $uncachedCommandCallback($command, $additionalData, $cache); }, $content, -1, $count); return $count; }
[ "protected", "function", "replaceUncachedPlaceholders", "(", "\\", "Closure", "$", "uncachedCommandCallback", ",", "&", "$", "content", ")", "{", "$", "cache", "=", "$", "this", "->", "cache", ";", "$", "content", "=", "preg_replace_callback", "(", "self", "::...
Replace segments which are marked as not-cacheable by their actual content by invoking the Fusion Runtime. @param \Closure $uncachedCommandCallback @param string $content The content potentially containing not cacheable segments marked by the respective tokens @return integer Number of replaced placeholders
[ "Replace", "segments", "which", "are", "marked", "as", "not", "-", "cacheable", "by", "their", "actual", "content", "by", "invoking", "the", "Fusion", "Runtime", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Cache/ContentCache.php#L321-L331
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Cache/ContentCache.php
ContentCache.serializeContext
protected function serializeContext(array $contextVariables) { $serializedContextArray = []; foreach ($contextVariables as $variableName => $contextValue) { // TODO This relies on a converter being available from the context value type to string if ($contextValue !== null) { $serializedContextArray[$variableName]['type'] = $this->getTypeForContextValue($contextValue); $serializedContextArray[$variableName]['value'] = $this->propertyMapper->convert($contextValue, 'string'); } } return $serializedContextArray; }
php
protected function serializeContext(array $contextVariables) { $serializedContextArray = []; foreach ($contextVariables as $variableName => $contextValue) { // TODO This relies on a converter being available from the context value type to string if ($contextValue !== null) { $serializedContextArray[$variableName]['type'] = $this->getTypeForContextValue($contextValue); $serializedContextArray[$variableName]['value'] = $this->propertyMapper->convert($contextValue, 'string'); } } return $serializedContextArray; }
[ "protected", "function", "serializeContext", "(", "array", "$", "contextVariables", ")", "{", "$", "serializedContextArray", "=", "[", "]", ";", "foreach", "(", "$", "contextVariables", "as", "$", "variableName", "=>", "$", "contextValue", ")", "{", "// TODO Thi...
Generates an array of strings from the given array of context variables @param array $contextVariables @return array @throws \InvalidArgumentException
[ "Generates", "an", "array", "of", "strings", "from", "the", "given", "array", "of", "context", "variables" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Cache/ContentCache.php#L340-L352
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php
RuntimeContentCache.addTag
public function addTag($key, $value) { $key = trim($key); if ($key === '') { throw new Exception('Tag Key must not be empty', 1448264366); } $value = trim($value); if ($value === '') { throw new Exception('Tag Value must not be empty', 1448264367); } $tag = Functions::ucfirst($key) . 'DynamicTag_' . $value; $this->tags[$tag] = true; }
php
public function addTag($key, $value) { $key = trim($key); if ($key === '') { throw new Exception('Tag Key must not be empty', 1448264366); } $value = trim($value); if ($value === '') { throw new Exception('Tag Value must not be empty', 1448264367); } $tag = Functions::ucfirst($key) . 'DynamicTag_' . $value; $this->tags[$tag] = true; }
[ "public", "function", "addTag", "(", "$", "key", ",", "$", "value", ")", "{", "$", "key", "=", "trim", "(", "$", "key", ")", ";", "if", "(", "$", "key", "===", "''", ")", "{", "throw", "new", "Exception", "(", "'Tag Key must not be empty'", ",", "1...
Adds a tag built from the given key and value. @param string $key @param string $value @return void @throws Exception
[ "Adds", "a", "tag", "built", "from", "the", "given", "key", "and", "value", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php#L86-L98
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php
RuntimeContentCache.enter
public function enter(array $configuration, $fusionPath) { $cacheForPathEnabled = isset($configuration['mode']) && ($configuration['mode'] === 'cached' || $configuration['mode'] === 'dynamic'); $cacheForPathDisabled = isset($configuration['mode']) && ($configuration['mode'] === 'uncached' || $configuration['mode'] === 'dynamic'); if ($cacheForPathDisabled && (!isset($configuration['context']) || $configuration['context'] === [])) { throw new Exception(sprintf('Missing @cache.context configuration for path "%s". An uncached segment must have one or more context variable names configured.', $fusionPath), 1395922119); } $currentPathIsEntryPoint = false; if ($this->enableContentCache && $cacheForPathEnabled) { if ($this->inCacheEntryPoint === null) { $this->inCacheEntryPoint = true; $currentPathIsEntryPoint = true; } } return [ 'configuration' => $configuration, 'fusionPath' => $fusionPath, 'cacheForPathEnabled' => $cacheForPathEnabled, 'cacheForPathDisabled' => $cacheForPathDisabled, 'currentPathIsEntryPoint' => $currentPathIsEntryPoint ]; }
php
public function enter(array $configuration, $fusionPath) { $cacheForPathEnabled = isset($configuration['mode']) && ($configuration['mode'] === 'cached' || $configuration['mode'] === 'dynamic'); $cacheForPathDisabled = isset($configuration['mode']) && ($configuration['mode'] === 'uncached' || $configuration['mode'] === 'dynamic'); if ($cacheForPathDisabled && (!isset($configuration['context']) || $configuration['context'] === [])) { throw new Exception(sprintf('Missing @cache.context configuration for path "%s". An uncached segment must have one or more context variable names configured.', $fusionPath), 1395922119); } $currentPathIsEntryPoint = false; if ($this->enableContentCache && $cacheForPathEnabled) { if ($this->inCacheEntryPoint === null) { $this->inCacheEntryPoint = true; $currentPathIsEntryPoint = true; } } return [ 'configuration' => $configuration, 'fusionPath' => $fusionPath, 'cacheForPathEnabled' => $cacheForPathEnabled, 'cacheForPathDisabled' => $cacheForPathDisabled, 'currentPathIsEntryPoint' => $currentPathIsEntryPoint ]; }
[ "public", "function", "enter", "(", "array", "$", "configuration", ",", "$", "fusionPath", ")", "{", "$", "cacheForPathEnabled", "=", "isset", "(", "$", "configuration", "[", "'mode'", "]", ")", "&&", "(", "$", "configuration", "[", "'mode'", "]", "===", ...
Enter an evaluation Needs to be called right before evaluation of a path starts to check the cache mode and set internal state like the cache entry point. @param array $configuration @param string $fusionPath @return array An evaluate context array that needs to be passed to subsequent calls to pass the current state @throws Exception
[ "Enter", "an", "evaluation" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php#L123-L147
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php
RuntimeContentCache.postProcess
public function postProcess(array $evaluateContext, $fusionObject, $output) { if ($this->enableContentCache && $evaluateContext['cacheForPathEnabled'] && $evaluateContext['cacheForPathDisabled']) { $contextArray = $this->runtime->getCurrentContext(); if (isset($evaluateContext['configuration']['context'])) { $contextVariables = []; foreach ($evaluateContext['configuration']['context'] as $contextVariableName) { $contextVariables[$contextVariableName] = $contextArray[$contextVariableName]; } } else { $contextVariables = $contextArray; } $cacheTags = $this->buildCacheTags($evaluateContext['configuration'], $evaluateContext['fusionPath'], $fusionObject); $cacheMetadata = array_pop($this->cacheMetadata); $output = $this->contentCache->createDynamicCachedSegment($output, $evaluateContext['fusionPath'], $contextVariables, $evaluateContext['cacheIdentifierValues'], $cacheTags, $cacheMetadata['lifetime'], $evaluateContext['cacheDiscriminator']); } elseif ($this->enableContentCache && $evaluateContext['cacheForPathEnabled']) { $cacheTags = $this->buildCacheTags($evaluateContext['configuration'], $evaluateContext['fusionPath'], $fusionObject); $cacheMetadata = array_pop($this->cacheMetadata); $output = $this->contentCache->createCacheSegment($output, $evaluateContext['fusionPath'], $evaluateContext['cacheIdentifierValues'], $cacheTags, $cacheMetadata['lifetime']); } elseif ($this->enableContentCache && $evaluateContext['cacheForPathDisabled'] && $this->inCacheEntryPoint) { $contextArray = $this->runtime->getCurrentContext(); if (isset($evaluateContext['configuration']['context'])) { $contextVariables = []; foreach ($evaluateContext['configuration']['context'] as $contextVariableName) { if (isset($contextArray[$contextVariableName])) { $contextVariables[$contextVariableName] = $contextArray[$contextVariableName]; } else { $contextVariables[$contextVariableName] = null; } } } else { $contextVariables = $contextArray; } $output = $this->contentCache->createUncachedSegment($output, $evaluateContext['fusionPath'], $contextVariables); } if ($evaluateContext['cacheForPathEnabled'] && $evaluateContext['currentPathIsEntryPoint']) { $output = $this->contentCache->processCacheSegments($output, $this->enableContentCache); $this->inCacheEntryPoint = null; $this->addCacheSegmentMarkersToPlaceholders = false; } return $output; }
php
public function postProcess(array $evaluateContext, $fusionObject, $output) { if ($this->enableContentCache && $evaluateContext['cacheForPathEnabled'] && $evaluateContext['cacheForPathDisabled']) { $contextArray = $this->runtime->getCurrentContext(); if (isset($evaluateContext['configuration']['context'])) { $contextVariables = []; foreach ($evaluateContext['configuration']['context'] as $contextVariableName) { $contextVariables[$contextVariableName] = $contextArray[$contextVariableName]; } } else { $contextVariables = $contextArray; } $cacheTags = $this->buildCacheTags($evaluateContext['configuration'], $evaluateContext['fusionPath'], $fusionObject); $cacheMetadata = array_pop($this->cacheMetadata); $output = $this->contentCache->createDynamicCachedSegment($output, $evaluateContext['fusionPath'], $contextVariables, $evaluateContext['cacheIdentifierValues'], $cacheTags, $cacheMetadata['lifetime'], $evaluateContext['cacheDiscriminator']); } elseif ($this->enableContentCache && $evaluateContext['cacheForPathEnabled']) { $cacheTags = $this->buildCacheTags($evaluateContext['configuration'], $evaluateContext['fusionPath'], $fusionObject); $cacheMetadata = array_pop($this->cacheMetadata); $output = $this->contentCache->createCacheSegment($output, $evaluateContext['fusionPath'], $evaluateContext['cacheIdentifierValues'], $cacheTags, $cacheMetadata['lifetime']); } elseif ($this->enableContentCache && $evaluateContext['cacheForPathDisabled'] && $this->inCacheEntryPoint) { $contextArray = $this->runtime->getCurrentContext(); if (isset($evaluateContext['configuration']['context'])) { $contextVariables = []; foreach ($evaluateContext['configuration']['context'] as $contextVariableName) { if (isset($contextArray[$contextVariableName])) { $contextVariables[$contextVariableName] = $contextArray[$contextVariableName]; } else { $contextVariables[$contextVariableName] = null; } } } else { $contextVariables = $contextArray; } $output = $this->contentCache->createUncachedSegment($output, $evaluateContext['fusionPath'], $contextVariables); } if ($evaluateContext['cacheForPathEnabled'] && $evaluateContext['currentPathIsEntryPoint']) { $output = $this->contentCache->processCacheSegments($output, $this->enableContentCache); $this->inCacheEntryPoint = null; $this->addCacheSegmentMarkersToPlaceholders = false; } return $output; }
[ "public", "function", "postProcess", "(", "array", "$", "evaluateContext", ",", "$", "fusionObject", ",", "$", "output", ")", "{", "if", "(", "$", "this", "->", "enableContentCache", "&&", "$", "evaluateContext", "[", "'cacheForPathEnabled'", "]", "&&", "$", ...
Post process output for caching information The content cache stores cache segments with markers inside the generated content. This method creates cache segments and will process the final outer result (currentPathIsEntryPoint) to remove all cache markers and store cache entries. @param array $evaluateContext The current evaluation context @param object $fusionObject The current Fusion object (for "this" in evaluations) @param mixed $output The generated output after caching information was removed @return mixed The post-processed output with cache segment markers or cleaned for the entry point
[ "Post", "process", "output", "for", "caching", "information" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php#L241-L284
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php
RuntimeContentCache.evaluateUncached
public function evaluateUncached($path, array $contextArray) { $previousEnableContentCache = $this->enableContentCache; $this->enableContentCache = false; $this->runtime->pushContextArray($contextArray); $result = $this->runtime->evaluate($path); $this->runtime->popContext(); $this->enableContentCache = $previousEnableContentCache; return $result; }
php
public function evaluateUncached($path, array $contextArray) { $previousEnableContentCache = $this->enableContentCache; $this->enableContentCache = false; $this->runtime->pushContextArray($contextArray); $result = $this->runtime->evaluate($path); $this->runtime->popContext(); $this->enableContentCache = $previousEnableContentCache; return $result; }
[ "public", "function", "evaluateUncached", "(", "$", "path", ",", "array", "$", "contextArray", ")", "{", "$", "previousEnableContentCache", "=", "$", "this", "->", "enableContentCache", ";", "$", "this", "->", "enableContentCache", "=", "false", ";", "$", "thi...
Evaluate a Fusion path with a given context without content caching This is used to render uncached segments "out of band" in getCachedSegment of ContentCache. @param string $path @param array $contextArray @return mixed TODO Find another way of disabling the cache (especially to allow cached content inside uncached content)
[ "Evaluate", "a", "Fusion", "path", "with", "a", "given", "context", "without", "content", "caching" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php#L312-L321
train
neos/neos-development-collection
Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php
RuntimeContentCache.buildCacheTags
protected function buildCacheTags(array $configuration, $fusionPath, $fusionObject) { $cacheTags = []; if (isset($configuration['entryTags'])) { foreach ($configuration['entryTags'] as $tagKey => $tagValue) { $tagValue = $this->runtime->evaluate($fusionPath . '/__meta/cache/entryTags/' . $tagKey, $fusionObject); if (is_array($tagValue)) { $cacheTags = array_merge($cacheTags, $tagValue); } elseif ((string)$tagValue !== '') { $cacheTags[] = $tagValue; } } foreach ($this->flushTags() as $tagKey => $tagValue) { $cacheTags[] = $tagValue; } } else { $cacheTags = [ContentCache::TAG_EVERYTHING]; } return array_unique($cacheTags); }
php
protected function buildCacheTags(array $configuration, $fusionPath, $fusionObject) { $cacheTags = []; if (isset($configuration['entryTags'])) { foreach ($configuration['entryTags'] as $tagKey => $tagValue) { $tagValue = $this->runtime->evaluate($fusionPath . '/__meta/cache/entryTags/' . $tagKey, $fusionObject); if (is_array($tagValue)) { $cacheTags = array_merge($cacheTags, $tagValue); } elseif ((string)$tagValue !== '') { $cacheTags[] = $tagValue; } } foreach ($this->flushTags() as $tagKey => $tagValue) { $cacheTags[] = $tagValue; } } else { $cacheTags = [ContentCache::TAG_EVERYTHING]; } return array_unique($cacheTags); }
[ "protected", "function", "buildCacheTags", "(", "array", "$", "configuration", ",", "$", "fusionPath", ",", "$", "fusionObject", ")", "{", "$", "cacheTags", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "configuration", "[", "'entryTags'", "]", ")", ...
Builds an array of string which must be used as tags for the cache entry identifier of a specific cached content segment. @param array $configuration @param string $fusionPath @param object $fusionObject The actual Fusion object @return array
[ "Builds", "an", "array", "of", "string", "which", "must", "be", "used", "as", "tags", "for", "the", "cache", "entry", "identifier", "of", "a", "specific", "cached", "content", "segment", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php#L349-L368
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/SiteExportService.php
SiteExportService.export
public function export(array $sites, $tidy = false, $nodeTypeFilter = null) { $this->xmlWriter = new \XMLWriter(); $this->xmlWriter->openMemory(); $this->xmlWriter->setIndent($tidy); $this->exportSites($sites, $nodeTypeFilter); return $this->xmlWriter->outputMemory(true); }
php
public function export(array $sites, $tidy = false, $nodeTypeFilter = null) { $this->xmlWriter = new \XMLWriter(); $this->xmlWriter->openMemory(); $this->xmlWriter->setIndent($tidy); $this->exportSites($sites, $nodeTypeFilter); return $this->xmlWriter->outputMemory(true); }
[ "public", "function", "export", "(", "array", "$", "sites", ",", "$", "tidy", "=", "false", ",", "$", "nodeTypeFilter", "=", "null", ")", "{", "$", "this", "->", "xmlWriter", "=", "new", "\\", "XMLWriter", "(", ")", ";", "$", "this", "->", "xmlWriter...
Fetches the site with the given name and exports it into XML. @param array<Site> $sites @param boolean $tidy Whether to export formatted XML @param string $nodeTypeFilter Filter the node type of the nodes, allows complex expressions (e.g. "Neos.Neos:Page", "!Neos.Neos:Page,Neos.Neos:Text") @return string
[ "Fetches", "the", "site", "with", "the", "given", "name", "and", "exports", "it", "into", "XML", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/SiteExportService.php#L70-L79
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/SiteExportService.php
SiteExportService.exportToPackage
public function exportToPackage(array $sites, $tidy = false, $packageKey, $nodeTypeFilter = null) { if (!$this->packageManager->isPackageAvailable($packageKey)) { throw new NeosException(sprintf('Error: Package "%s" is not active.', $packageKey), 1404375719); } $contentPathAndFilename = sprintf('resource://%s/Private/Content/Sites.xml', $packageKey); $this->resourcesPath = Files::concatenatePaths([dirname($contentPathAndFilename), 'Resources']); Files::createDirectoryRecursively($this->resourcesPath); $this->xmlWriter = new \XMLWriter(); $this->xmlWriter->openUri($contentPathAndFilename); $this->xmlWriter->setIndent($tidy); $this->exportSites($sites, $nodeTypeFilter); $this->xmlWriter->flush(); }
php
public function exportToPackage(array $sites, $tidy = false, $packageKey, $nodeTypeFilter = null) { if (!$this->packageManager->isPackageAvailable($packageKey)) { throw new NeosException(sprintf('Error: Package "%s" is not active.', $packageKey), 1404375719); } $contentPathAndFilename = sprintf('resource://%s/Private/Content/Sites.xml', $packageKey); $this->resourcesPath = Files::concatenatePaths([dirname($contentPathAndFilename), 'Resources']); Files::createDirectoryRecursively($this->resourcesPath); $this->xmlWriter = new \XMLWriter(); $this->xmlWriter->openUri($contentPathAndFilename); $this->xmlWriter->setIndent($tidy); $this->exportSites($sites, $nodeTypeFilter); $this->xmlWriter->flush(); }
[ "public", "function", "exportToPackage", "(", "array", "$", "sites", ",", "$", "tidy", "=", "false", ",", "$", "packageKey", ",", "$", "nodeTypeFilter", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "packageManager", "->", "isPackageAvailable",...
Fetches the site with the given name and exports it into XML in the given package. @param array<Site> $sites @param boolean $tidy Whether to export formatted XML @param string $packageKey Package key where the export output should be saved to @param string $nodeTypeFilter Filter the node type of the nodes, allows complex expressions (e.g. "Neos.Neos:Page", "!Neos.Neos:Page,Neos.Neos:Text") @return void @throws NeosException
[ "Fetches", "the", "site", "with", "the", "given", "name", "and", "exports", "it", "into", "XML", "in", "the", "given", "package", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/SiteExportService.php#L91-L108
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/SiteExportService.php
SiteExportService.exportToFile
public function exportToFile(array $sites, $tidy = false, $pathAndFilename, $nodeTypeFilter = null) { $this->resourcesPath = Files::concatenatePaths([dirname($pathAndFilename), 'Resources']); Files::createDirectoryRecursively($this->resourcesPath); $this->xmlWriter = new \XMLWriter(); $this->xmlWriter->openUri($pathAndFilename); $this->xmlWriter->setIndent($tidy); $this->exportSites($sites, $nodeTypeFilter); $this->xmlWriter->flush(); }
php
public function exportToFile(array $sites, $tidy = false, $pathAndFilename, $nodeTypeFilter = null) { $this->resourcesPath = Files::concatenatePaths([dirname($pathAndFilename), 'Resources']); Files::createDirectoryRecursively($this->resourcesPath); $this->xmlWriter = new \XMLWriter(); $this->xmlWriter->openUri($pathAndFilename); $this->xmlWriter->setIndent($tidy); $this->exportSites($sites, $nodeTypeFilter); $this->xmlWriter->flush(); }
[ "public", "function", "exportToFile", "(", "array", "$", "sites", ",", "$", "tidy", "=", "false", ",", "$", "pathAndFilename", ",", "$", "nodeTypeFilter", "=", "null", ")", "{", "$", "this", "->", "resourcesPath", "=", "Files", "::", "concatenatePaths", "(...
Fetches the site with the given name and exports it as XML into the given file. @param array<Site> $sites @param boolean $tidy Whether to export formatted XML @param string $pathAndFilename Path to where the export output should be saved to @param string $nodeTypeFilter Filter the node type of the nodes, allows complex expressions (e.g. "Neos.Neos:Page", "!Neos.Neos:Page,Neos.Neos:Text") @return void
[ "Fetches", "the", "site", "with", "the", "given", "name", "and", "exports", "it", "as", "XML", "into", "the", "given", "file", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/SiteExportService.php#L119-L131
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/SiteExportService.php
SiteExportService.exportSites
protected function exportSites(array $sites, $nodeTypeFilter) { $this->xmlWriter->startDocument('1.0', 'UTF-8'); $this->xmlWriter->startElement('root'); foreach ($sites as $site) { $this->exportSite($site, $nodeTypeFilter); } $this->xmlWriter->endElement(); $this->xmlWriter->endDocument(); }
php
protected function exportSites(array $sites, $nodeTypeFilter) { $this->xmlWriter->startDocument('1.0', 'UTF-8'); $this->xmlWriter->startElement('root'); foreach ($sites as $site) { $this->exportSite($site, $nodeTypeFilter); } $this->xmlWriter->endElement(); $this->xmlWriter->endDocument(); }
[ "protected", "function", "exportSites", "(", "array", "$", "sites", ",", "$", "nodeTypeFilter", ")", "{", "$", "this", "->", "xmlWriter", "->", "startDocument", "(", "'1.0'", ",", "'UTF-8'", ")", ";", "$", "this", "->", "xmlWriter", "->", "startElement", "...
Exports the given sites to the XMLWriter @param array<Site> $sites @param string $nodeTypeFilter @return void
[ "Exports", "the", "given", "sites", "to", "the", "XMLWriter" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/SiteExportService.php#L140-L151
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Strategy/AssetUsageInNodePropertiesStrategy.php
AssetUsageInNodePropertiesStrategy.getUsageReferences
public function getUsageReferences(AssetInterface $asset) { $assetIdentifier = $this->persistenceManager->getIdentifierByObject($asset); if (isset($this->firstlevelCache[$assetIdentifier])) { return $this->firstlevelCache[$assetIdentifier]; } $relatedNodes = array_map(function (NodeData $relatedNodeData) use ($asset) { return new AssetUsageInNodeProperties($asset, $relatedNodeData->getIdentifier(), $relatedNodeData->getWorkspace()->getName(), $relatedNodeData->getDimensionValues(), $relatedNodeData->getNodeType()->getName() ); }, $this->getRelatedNodes($asset)); $this->firstlevelCache[$assetIdentifier] = $relatedNodes; return $this->firstlevelCache[$assetIdentifier]; }
php
public function getUsageReferences(AssetInterface $asset) { $assetIdentifier = $this->persistenceManager->getIdentifierByObject($asset); if (isset($this->firstlevelCache[$assetIdentifier])) { return $this->firstlevelCache[$assetIdentifier]; } $relatedNodes = array_map(function (NodeData $relatedNodeData) use ($asset) { return new AssetUsageInNodeProperties($asset, $relatedNodeData->getIdentifier(), $relatedNodeData->getWorkspace()->getName(), $relatedNodeData->getDimensionValues(), $relatedNodeData->getNodeType()->getName() ); }, $this->getRelatedNodes($asset)); $this->firstlevelCache[$assetIdentifier] = $relatedNodes; return $this->firstlevelCache[$assetIdentifier]; }
[ "public", "function", "getUsageReferences", "(", "AssetInterface", "$", "asset", ")", "{", "$", "assetIdentifier", "=", "$", "this", "->", "persistenceManager", "->", "getIdentifierByObject", "(", "$", "asset", ")", ";", "if", "(", "isset", "(", "$", "this", ...
Returns an array of usage reference objects. @param AssetInterface $asset @return array<\Neos\Neos\Domain\Model\Dto\AssetUsageInNodeProperties> @throws \Neos\ContentRepository\Exception\NodeConfigurationException
[ "Returns", "an", "array", "of", "usage", "reference", "objects", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Strategy/AssetUsageInNodePropertiesStrategy.php#L57-L75
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Strategy/AssetUsageInNodePropertiesStrategy.php
AssetUsageInNodePropertiesStrategy.getRelatedNodes
public function getRelatedNodes(AssetInterface $asset) { $relationMap = []; $relationMap[TypeHandling::getTypeForValue($asset)] = [$this->persistenceManager->getIdentifierByObject($asset)]; if ($asset instanceof Image) { foreach ($asset->getVariants() as $variant) { $type = TypeHandling::getTypeForValue($variant); if (!isset($relationMap[$type])) { $relationMap[$type] = []; } $relationMap[$type][] = $this->persistenceManager->getIdentifierByObject($variant); } } return $this->nodeDataRepository->findNodesByPathPrefixAndRelatedEntities(SiteService::SITES_ROOT_PATH, $relationMap); }
php
public function getRelatedNodes(AssetInterface $asset) { $relationMap = []; $relationMap[TypeHandling::getTypeForValue($asset)] = [$this->persistenceManager->getIdentifierByObject($asset)]; if ($asset instanceof Image) { foreach ($asset->getVariants() as $variant) { $type = TypeHandling::getTypeForValue($variant); if (!isset($relationMap[$type])) { $relationMap[$type] = []; } $relationMap[$type][] = $this->persistenceManager->getIdentifierByObject($variant); } } return $this->nodeDataRepository->findNodesByPathPrefixAndRelatedEntities(SiteService::SITES_ROOT_PATH, $relationMap); }
[ "public", "function", "getRelatedNodes", "(", "AssetInterface", "$", "asset", ")", "{", "$", "relationMap", "=", "[", "]", ";", "$", "relationMap", "[", "TypeHandling", "::", "getTypeForValue", "(", "$", "asset", ")", "]", "=", "[", "$", "this", "->", "p...
Returns all nodes that use the asset in a node property. @param AssetInterface $asset @return array
[ "Returns", "all", "nodes", "that", "use", "the", "asset", "in", "a", "node", "property", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Strategy/AssetUsageInNodePropertiesStrategy.php#L83-L99
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Service/WorkspacesController.php
WorkspacesController.indexAction
public function indexAction() { $user = $this->userService->getCurrentUser(); $workspacesArray = []; /** @var Workspace $workspace */ foreach ($this->workspaceRepository->findAll() as $workspace) { // FIXME: This check should be implemented through a specialized Workspace Privilege or something similar if ($workspace->getOwner() !== null && $workspace->getOwner() !== $user) { continue; } $workspaceArray = [ 'name' => $workspace->getName(), 'title' => $workspace->getTitle(), 'description' => $workspace->getDescription(), 'baseWorkspace' => $workspace->getBaseWorkspace() ]; if ($user !== null) { $workspaceArray['readonly'] = !$this->userService->currentUserCanPublishToWorkspace($workspace); } $workspacesArray[] = $workspaceArray; } $this->view->assign('workspaces', $workspacesArray); }
php
public function indexAction() { $user = $this->userService->getCurrentUser(); $workspacesArray = []; /** @var Workspace $workspace */ foreach ($this->workspaceRepository->findAll() as $workspace) { // FIXME: This check should be implemented through a specialized Workspace Privilege or something similar if ($workspace->getOwner() !== null && $workspace->getOwner() !== $user) { continue; } $workspaceArray = [ 'name' => $workspace->getName(), 'title' => $workspace->getTitle(), 'description' => $workspace->getDescription(), 'baseWorkspace' => $workspace->getBaseWorkspace() ]; if ($user !== null) { $workspaceArray['readonly'] = !$this->userService->currentUserCanPublishToWorkspace($workspace); } $workspacesArray[] = $workspaceArray; } $this->view->assign('workspaces', $workspacesArray); }
[ "public", "function", "indexAction", "(", ")", "{", "$", "user", "=", "$", "this", "->", "userService", "->", "getCurrentUser", "(", ")", ";", "$", "workspacesArray", "=", "[", "]", ";", "/** @var Workspace $workspace */", "foreach", "(", "$", "this", "->", ...
Shows a list of existing workspaces @return string
[ "Shows", "a", "list", "of", "existing", "workspaces" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Service/WorkspacesController.php#L66-L91
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Service/WorkspacesController.php
WorkspacesController.initializeUpdateAction
public function initializeUpdateAction() { $propertyMappingConfiguration = $this->arguments->getArgument('workspace')->getPropertyMappingConfiguration(); $propertyMappingConfiguration->allowProperties('name', 'baseWorkspace'); $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED, true); }
php
public function initializeUpdateAction() { $propertyMappingConfiguration = $this->arguments->getArgument('workspace')->getPropertyMappingConfiguration(); $propertyMappingConfiguration->allowProperties('name', 'baseWorkspace'); $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED, true); }
[ "public", "function", "initializeUpdateAction", "(", ")", "{", "$", "propertyMappingConfiguration", "=", "$", "this", "->", "arguments", "->", "getArgument", "(", "'workspace'", ")", "->", "getPropertyMappingConfiguration", "(", ")", ";", "$", "propertyMappingConfigur...
Configure property mapping for the updateAction @return void
[ "Configure", "property", "mapping", "for", "the", "updateAction" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Service/WorkspacesController.php#L138-L143
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Model/UserInterfaceMode.php
UserInterfaceMode.createByConfiguration
public static function createByConfiguration($modeName, array $configuration) { $mode = new static(); $mode->setName($modeName); $mode->setPreview($configuration['isPreviewMode']); $mode->setEdit($configuration['isEditingMode']); $mode->setTitle($configuration['title']); if (isset($configuration['fusionRenderingPath'])) { $mode->setFusionPath($configuration['fusionRenderingPath']); } else { $mode->setFusionPath(''); } if (isset($configuration['options']) && is_array($configuration['options'])) { $mode->setOptions($configuration['options']); } return $mode; }
php
public static function createByConfiguration($modeName, array $configuration) { $mode = new static(); $mode->setName($modeName); $mode->setPreview($configuration['isPreviewMode']); $mode->setEdit($configuration['isEditingMode']); $mode->setTitle($configuration['title']); if (isset($configuration['fusionRenderingPath'])) { $mode->setFusionPath($configuration['fusionRenderingPath']); } else { $mode->setFusionPath(''); } if (isset($configuration['options']) && is_array($configuration['options'])) { $mode->setOptions($configuration['options']); } return $mode; }
[ "public", "static", "function", "createByConfiguration", "(", "$", "modeName", ",", "array", "$", "configuration", ")", "{", "$", "mode", "=", "new", "static", "(", ")", ";", "$", "mode", "->", "setName", "(", "$", "modeName", ")", ";", "$", "mode", "-...
Creates an UserInterfaceMode object by configuration @param string $modeName @param array $configuration @return static
[ "Creates", "an", "UserInterfaceMode", "object", "by", "configuration" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Model/UserInterfaceMode.php#L169-L188
train
neos/neos-development-collection
Neos.Neos/Classes/Service/ImageVariantGarbageCollector.php
ImageVariantGarbageCollector.removeUnusedImageVariant
public function removeUnusedImageVariant(NodeInterface $node, $propertyName, $oldValue, $value) { if ($oldValue === $value || (!$oldValue instanceof ImageVariant)) { return; } $identifier = $this->persistenceManager->getIdentifierByObject($oldValue); $results = $this->nodeDataRepository->findNodesByRelatedEntities([ImageVariant::class => [$identifier]]); // This case shouldn't happen as the query will usually find at least the node that triggered this call, still if there is no relation we can remove the ImageVariant. if ($results === []) { $this->assetRepository->remove($oldValue); return; } // If the result contains exactly the node that got a new ImageVariant assigned then we are safe to remove the asset here. if ($results === [$node->getNodeData()]) { $this->assetRepository->remove($oldValue); } }
php
public function removeUnusedImageVariant(NodeInterface $node, $propertyName, $oldValue, $value) { if ($oldValue === $value || (!$oldValue instanceof ImageVariant)) { return; } $identifier = $this->persistenceManager->getIdentifierByObject($oldValue); $results = $this->nodeDataRepository->findNodesByRelatedEntities([ImageVariant::class => [$identifier]]); // This case shouldn't happen as the query will usually find at least the node that triggered this call, still if there is no relation we can remove the ImageVariant. if ($results === []) { $this->assetRepository->remove($oldValue); return; } // If the result contains exactly the node that got a new ImageVariant assigned then we are safe to remove the asset here. if ($results === [$node->getNodeData()]) { $this->assetRepository->remove($oldValue); } }
[ "public", "function", "removeUnusedImageVariant", "(", "NodeInterface", "$", "node", ",", "$", "propertyName", ",", "$", "oldValue", ",", "$", "value", ")", "{", "if", "(", "$", "oldValue", "===", "$", "value", "||", "(", "!", "$", "oldValue", "instanceof"...
Removes unused ImageVariants after a Node property changes to a different ImageVariant. This is triggered via the nodePropertyChanged event. Note: This method it triggered by the "nodePropertyChanged" signal, @see \Neos\ContentRepository\Domain\Model\Node::emitNodePropertyChanged() @param NodeInterface $node the affected node @param string $propertyName name of the property that has been changed/added @param mixed $oldValue the property value before it was changed or NULL if the property is new @param mixed $value the new property value @return void
[ "Removes", "unused", "ImageVariants", "after", "a", "Node", "property", "changes", "to", "a", "different", "ImageVariant", ".", "This", "is", "triggered", "via", "the", "nodePropertyChanged", "event", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/ImageVariantGarbageCollector.php#L58-L76
train
neos/neos-development-collection
Neos.Neos/Classes/Routing/BackendModuleRoutePartHandler.php
BackendModuleRoutePartHandler.matchValue
protected function matchValue($value) { $format = pathinfo($value, PATHINFO_EXTENSION); if ($format !== '') { $value = substr($value, 0, strlen($value) - strlen($format) - 1); } $segments = Arrays::trimExplode('/', $value); $currentModuleBase = $this->settings['modules']; if ($segments === [] || !isset($currentModuleBase[$segments[0]])) { return self::MATCHRESULT_NOSUCHMODULE; } $modulePath = []; $level = 0; $moduleConfiguration = null; $moduleController = null; $moduleAction = 'index'; foreach ($segments as $segment) { if (isset($currentModuleBase[$segment])) { $modulePath[] = $segment; $moduleConfiguration = $currentModuleBase[$segment]; if (isset($moduleConfiguration['controller'])) { $moduleController = $moduleConfiguration['controller']; } else { $moduleController = null; } if (isset($moduleConfiguration['submodules'])) { $currentModuleBase = $moduleConfiguration['submodules']; } else { $currentModuleBase = []; } } else { if ($level === count($segments) - 1) { $moduleMethods = array_change_key_case(array_flip(get_class_methods($moduleController)), CASE_LOWER); if (array_key_exists($segment . 'action', $moduleMethods)) { $moduleAction = $segment; break; } } return self::MATCHRESULT_NOSUCHMODULE; } $level++; } if ($moduleController === null) { return self::MATCHRESULT_NOCONTROLLER; } $this->value = [ 'module' => implode('/', $modulePath), 'controller' => $moduleController, 'action' => $moduleAction ]; if ($format !== '') { $this->value['format'] = $format; } return self::MATCHRESULT_FOUND; }
php
protected function matchValue($value) { $format = pathinfo($value, PATHINFO_EXTENSION); if ($format !== '') { $value = substr($value, 0, strlen($value) - strlen($format) - 1); } $segments = Arrays::trimExplode('/', $value); $currentModuleBase = $this->settings['modules']; if ($segments === [] || !isset($currentModuleBase[$segments[0]])) { return self::MATCHRESULT_NOSUCHMODULE; } $modulePath = []; $level = 0; $moduleConfiguration = null; $moduleController = null; $moduleAction = 'index'; foreach ($segments as $segment) { if (isset($currentModuleBase[$segment])) { $modulePath[] = $segment; $moduleConfiguration = $currentModuleBase[$segment]; if (isset($moduleConfiguration['controller'])) { $moduleController = $moduleConfiguration['controller']; } else { $moduleController = null; } if (isset($moduleConfiguration['submodules'])) { $currentModuleBase = $moduleConfiguration['submodules']; } else { $currentModuleBase = []; } } else { if ($level === count($segments) - 1) { $moduleMethods = array_change_key_case(array_flip(get_class_methods($moduleController)), CASE_LOWER); if (array_key_exists($segment . 'action', $moduleMethods)) { $moduleAction = $segment; break; } } return self::MATCHRESULT_NOSUCHMODULE; } $level++; } if ($moduleController === null) { return self::MATCHRESULT_NOCONTROLLER; } $this->value = [ 'module' => implode('/', $modulePath), 'controller' => $moduleController, 'action' => $moduleAction ]; if ($format !== '') { $this->value['format'] = $format; } return self::MATCHRESULT_FOUND; }
[ "protected", "function", "matchValue", "(", "$", "value", ")", "{", "$", "format", "=", "pathinfo", "(", "$", "value", ",", "PATHINFO_EXTENSION", ")", ";", "if", "(", "$", "format", "!==", "''", ")", "{", "$", "value", "=", "substr", "(", "$", "value...
Iterate through the segments of the current request path find the corresponding module configuration and set controller & action accordingly @param string $value @return boolean|integer
[ "Iterate", "through", "the", "segments", "of", "the", "current", "request", "path", "find", "the", "corresponding", "module", "configuration", "and", "set", "controller", "&", "action", "accordingly" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Routing/BackendModuleRoutePartHandler.php#L51-L113
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeExportService.php
NodeExportService.export
public function export($startingPointNodePath = '/', $workspaceName = 'live', \XMLWriter $xmlWriter = null, $tidy = true, $endDocument = true, $resourceSavePath = null, $nodeTypeFilter = null) { $this->propertyMappingConfiguration = new ImportExportPropertyMappingConfiguration($resourceSavePath); $this->exceptionsDuringExport = []; $this->exportedNodePaths = []; if ($startingPointNodePath !== '/') { $startingPointParentPath = substr($startingPointNodePath, 0, strrpos($startingPointNodePath, '/')); $this->exportedNodePaths[$startingPointParentPath] = true; } $this->xmlWriter = $xmlWriter; if ($this->xmlWriter === null) { $this->xmlWriter = new \XMLWriter(); $this->xmlWriter->openMemory(); $this->xmlWriter->setIndent($tidy); $this->xmlWriter->startDocument('1.0', 'UTF-8'); } $this->securityContext->withoutAuthorizationChecks(function () use ($startingPointNodePath, $workspaceName, $nodeTypeFilter) { $nodeDataList = $this->findNodeDataListToExport($startingPointNodePath, $workspaceName, $nodeTypeFilter); $this->exportNodeDataList($nodeDataList); }); if ($endDocument) { $this->xmlWriter->endDocument(); } $this->handleExceptionsDuringExport(); return $this->xmlWriter; }
php
public function export($startingPointNodePath = '/', $workspaceName = 'live', \XMLWriter $xmlWriter = null, $tidy = true, $endDocument = true, $resourceSavePath = null, $nodeTypeFilter = null) { $this->propertyMappingConfiguration = new ImportExportPropertyMappingConfiguration($resourceSavePath); $this->exceptionsDuringExport = []; $this->exportedNodePaths = []; if ($startingPointNodePath !== '/') { $startingPointParentPath = substr($startingPointNodePath, 0, strrpos($startingPointNodePath, '/')); $this->exportedNodePaths[$startingPointParentPath] = true; } $this->xmlWriter = $xmlWriter; if ($this->xmlWriter === null) { $this->xmlWriter = new \XMLWriter(); $this->xmlWriter->openMemory(); $this->xmlWriter->setIndent($tidy); $this->xmlWriter->startDocument('1.0', 'UTF-8'); } $this->securityContext->withoutAuthorizationChecks(function () use ($startingPointNodePath, $workspaceName, $nodeTypeFilter) { $nodeDataList = $this->findNodeDataListToExport($startingPointNodePath, $workspaceName, $nodeTypeFilter); $this->exportNodeDataList($nodeDataList); }); if ($endDocument) { $this->xmlWriter->endDocument(); } $this->handleExceptionsDuringExport(); return $this->xmlWriter; }
[ "public", "function", "export", "(", "$", "startingPointNodePath", "=", "'/'", ",", "$", "workspaceName", "=", "'live'", ",", "\\", "XMLWriter", "$", "xmlWriter", "=", "null", ",", "$", "tidy", "=", "true", ",", "$", "endDocument", "=", "true", ",", "$",...
Exports the node data of all nodes in the given sub-tree by writing them to the given XMLWriter. @param string $startingPointNodePath path to the root node of the sub-tree to export. The specified node will not be included, only its sub nodes. @param string $workspaceName @param \XMLWriter $xmlWriter @param boolean $tidy @param boolean $endDocument @param string $resourceSavePath @param string $nodeTypeFilter Filter the node type of the nodes, allows complex expressions (e.g. "Neos.Neos:Page", "!Neos.Neos:Page,Neos.Neos:Text") @return \XMLWriter
[ "Exports", "the", "node", "data", "of", "all", "nodes", "in", "the", "given", "sub", "-", "tree", "by", "writing", "them", "to", "the", "given", "XMLWriter", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeExportService.php#L146-L176
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeExportService.php
NodeExportService.writeConvertedElement
protected function writeConvertedElement(array &$data, $propertyName, $elementName = null, $declaredPropertyType = null) { if (array_key_exists($propertyName, $data) && $data[$propertyName] !== null) { $propertyValue = $data[$propertyName]; $this->xmlWriter->startElement($elementName ?: $propertyName); if (!empty($propertyValue)) { switch ($declaredPropertyType) { case null: case 'reference': case 'references': break; default: $propertyValue = $this->propertyMapper->convert($propertyValue, $declaredPropertyType); break; } } $this->xmlWriter->writeAttribute('__type', gettype($propertyValue)); try { if (is_object($propertyValue) && !$propertyValue instanceof \DateTimeInterface) { $objectIdentifier = $this->persistenceManager->getIdentifierByObject($propertyValue); if ($objectIdentifier !== null) { $this->xmlWriter->writeAttribute('__identifier', $objectIdentifier); } if ($propertyValue instanceof \Doctrine\ORM\Proxy\Proxy) { $className = get_parent_class($propertyValue); } else { $className = get_class($propertyValue); } $this->xmlWriter->writeAttribute('__classname', $className); $this->xmlWriter->writeAttribute('__encoding', 'json'); $converted = json_encode($this->propertyMapper->convert($propertyValue, 'array', $this->propertyMappingConfiguration)); $this->xmlWriter->text($converted); } elseif (is_array($propertyValue)) { foreach ($propertyValue as $key => $element) { $this->writeConvertedElement($propertyValue, $key, 'entry' . $key); } } else { if ($propertyValue instanceof \DateTimeInterface) { $this->xmlWriter->writeAttribute('__classname', 'DateTime'); } $this->xmlWriter->text($this->propertyMapper->convert($propertyValue, 'string', $this->propertyMappingConfiguration)); } } catch (\Exception $exception) { $this->xmlWriter->writeComment(sprintf('Could not convert property "%s" to string.', $propertyName)); $this->xmlWriter->writeComment($exception->getMessage()); $logMessage = $this->throwableStorage->logThrowable($exception); $this->logger->error($logMessage, LogEnvironment::fromMethodName(__METHOD__)); $this->exceptionsDuringExport[] = $exception; } $this->xmlWriter->endElement(); } }
php
protected function writeConvertedElement(array &$data, $propertyName, $elementName = null, $declaredPropertyType = null) { if (array_key_exists($propertyName, $data) && $data[$propertyName] !== null) { $propertyValue = $data[$propertyName]; $this->xmlWriter->startElement($elementName ?: $propertyName); if (!empty($propertyValue)) { switch ($declaredPropertyType) { case null: case 'reference': case 'references': break; default: $propertyValue = $this->propertyMapper->convert($propertyValue, $declaredPropertyType); break; } } $this->xmlWriter->writeAttribute('__type', gettype($propertyValue)); try { if (is_object($propertyValue) && !$propertyValue instanceof \DateTimeInterface) { $objectIdentifier = $this->persistenceManager->getIdentifierByObject($propertyValue); if ($objectIdentifier !== null) { $this->xmlWriter->writeAttribute('__identifier', $objectIdentifier); } if ($propertyValue instanceof \Doctrine\ORM\Proxy\Proxy) { $className = get_parent_class($propertyValue); } else { $className = get_class($propertyValue); } $this->xmlWriter->writeAttribute('__classname', $className); $this->xmlWriter->writeAttribute('__encoding', 'json'); $converted = json_encode($this->propertyMapper->convert($propertyValue, 'array', $this->propertyMappingConfiguration)); $this->xmlWriter->text($converted); } elseif (is_array($propertyValue)) { foreach ($propertyValue as $key => $element) { $this->writeConvertedElement($propertyValue, $key, 'entry' . $key); } } else { if ($propertyValue instanceof \DateTimeInterface) { $this->xmlWriter->writeAttribute('__classname', 'DateTime'); } $this->xmlWriter->text($this->propertyMapper->convert($propertyValue, 'string', $this->propertyMappingConfiguration)); } } catch (\Exception $exception) { $this->xmlWriter->writeComment(sprintf('Could not convert property "%s" to string.', $propertyName)); $this->xmlWriter->writeComment($exception->getMessage()); $logMessage = $this->throwableStorage->logThrowable($exception); $this->logger->error($logMessage, LogEnvironment::fromMethodName(__METHOD__)); $this->exceptionsDuringExport[] = $exception; } $this->xmlWriter->endElement(); } }
[ "protected", "function", "writeConvertedElement", "(", "array", "&", "$", "data", ",", "$", "propertyName", ",", "$", "elementName", "=", "null", ",", "$", "declaredPropertyType", "=", "null", ")", "{", "if", "(", "array_key_exists", "(", "$", "propertyName", ...
Writes out a single property into the XML structure. @param array $data The data as an array, the given property name is looked up there @param string $propertyName The name of the property @param string $elementName an optional name to use, defaults to $propertyName @return void
[ "Writes", "out", "a", "single", "property", "into", "the", "XML", "structure", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Service/ImportExport/NodeExportService.php#L375-L430
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/ContentContext.php
ContentContext.getCurrentSiteNode
public function getCurrentSiteNode() { if ($this->currentSite !== null && $this->currentSiteNode === null) { $siteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $this->currentSite->getNodeName()); $this->currentSiteNode = $this->getNode($siteNodePath); if (!($this->currentSiteNode instanceof NodeInterface)) { $this->systemLogger->warning(sprintf('Couldn\'t load the site node for path "%s" in workspace "%s". This is probably due to a missing baseworkspace for the workspace of the current user.', $siteNodePath, $this->workspaceName), LogEnvironment::fromMethodName(__METHOD__)); } } return $this->currentSiteNode; }
php
public function getCurrentSiteNode() { if ($this->currentSite !== null && $this->currentSiteNode === null) { $siteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $this->currentSite->getNodeName()); $this->currentSiteNode = $this->getNode($siteNodePath); if (!($this->currentSiteNode instanceof NodeInterface)) { $this->systemLogger->warning(sprintf('Couldn\'t load the site node for path "%s" in workspace "%s". This is probably due to a missing baseworkspace for the workspace of the current user.', $siteNodePath, $this->workspaceName), LogEnvironment::fromMethodName(__METHOD__)); } } return $this->currentSiteNode; }
[ "public", "function", "getCurrentSiteNode", "(", ")", "{", "if", "(", "$", "this", "->", "currentSite", "!==", "null", "&&", "$", "this", "->", "currentSiteNode", "===", "null", ")", "{", "$", "siteNodePath", "=", "NodePaths", "::", "addNodePathSegment", "("...
Returns the node of the current site. @return NodeInterface
[ "Returns", "the", "node", "of", "the", "current", "site", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/ContentContext.php#L111-L121
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/ContentContext.php
ContentContext.getProperties
public function getProperties() { return [ 'workspaceName' => $this->workspaceName, 'currentDateTime' => $this->currentDateTime, 'dimensions' => $this->dimensions, 'targetDimensions' => $this->targetDimensions, 'invisibleContentShown' => $this->invisibleContentShown, 'removedContentShown' => $this->removedContentShown, 'inaccessibleContentShown' => $this->inaccessibleContentShown, 'currentSite' => $this->currentSite, 'currentDomain' => $this->currentDomain ]; }
php
public function getProperties() { return [ 'workspaceName' => $this->workspaceName, 'currentDateTime' => $this->currentDateTime, 'dimensions' => $this->dimensions, 'targetDimensions' => $this->targetDimensions, 'invisibleContentShown' => $this->invisibleContentShown, 'removedContentShown' => $this->removedContentShown, 'inaccessibleContentShown' => $this->inaccessibleContentShown, 'currentSite' => $this->currentSite, 'currentDomain' => $this->currentDomain ]; }
[ "public", "function", "getProperties", "(", ")", "{", "return", "[", "'workspaceName'", "=>", "$", "this", "->", "workspaceName", ",", "'currentDateTime'", "=>", "$", "this", "->", "currentDateTime", ",", "'dimensions'", "=>", "$", "this", "->", "dimensions", ...
Returns the properties of this context. @return array
[ "Returns", "the", "properties", "of", "this", "context", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/ContentContext.php#L128-L141
train
neos/neos-development-collection
Neos.Neos/Classes/Fusion/PluginImplementation.php
PluginImplementation.buildPluginRequest
protected function buildPluginRequest() { /** @var $parentRequest ActionRequest */ $parentRequest = $this->runtime->getControllerContext()->getRequest(); $pluginRequest = new ActionRequest($parentRequest); $pluginRequest->setArgumentNamespace('--' . $this->getPluginNamespace()); $this->passArgumentsToPluginRequest($pluginRequest); if ($this->node instanceof NodeInterface) { $pluginRequest->setArgument('__node', $this->node); if ($pluginRequest->getControllerPackageKey() === null) { $pluginRequest->setControllerPackageKey($this->node->getProperty('package') ?: $this->getPackage()); } if ($pluginRequest->getControllerSubpackageKey() === null) { $pluginRequest->setControllerSubpackageKey($this->node->getProperty('subpackage') ?: $this->getSubpackage()); } if ($pluginRequest->getControllerName() === null) { $pluginRequest->setControllerName($this->node->getProperty('controller') ?: $this->getController()); } if ($pluginRequest->getControllerActionName() === null) { $actionName = $this->node->getProperty('action'); if ($actionName === null || $actionName === '') { $actionName = $this->getAction() !== null ? $this->getAction() : 'index'; } $pluginRequest->setControllerActionName($actionName); } $pluginRequest->setArgument('__node', $this->node); $pluginRequest->setArgument('__documentNode', $this->documentNode); } else { $pluginRequest->setControllerPackageKey($this->getPackage()); $pluginRequest->setControllerSubpackageKey($this->getSubpackage()); $pluginRequest->setControllerName($this->getController()); $pluginRequest->setControllerActionName($this->getAction()); } foreach ($this->properties as $key => $value) { $pluginRequest->setArgument('__' . $key, $this->fusionValue($key)); } return $pluginRequest; }
php
protected function buildPluginRequest() { /** @var $parentRequest ActionRequest */ $parentRequest = $this->runtime->getControllerContext()->getRequest(); $pluginRequest = new ActionRequest($parentRequest); $pluginRequest->setArgumentNamespace('--' . $this->getPluginNamespace()); $this->passArgumentsToPluginRequest($pluginRequest); if ($this->node instanceof NodeInterface) { $pluginRequest->setArgument('__node', $this->node); if ($pluginRequest->getControllerPackageKey() === null) { $pluginRequest->setControllerPackageKey($this->node->getProperty('package') ?: $this->getPackage()); } if ($pluginRequest->getControllerSubpackageKey() === null) { $pluginRequest->setControllerSubpackageKey($this->node->getProperty('subpackage') ?: $this->getSubpackage()); } if ($pluginRequest->getControllerName() === null) { $pluginRequest->setControllerName($this->node->getProperty('controller') ?: $this->getController()); } if ($pluginRequest->getControllerActionName() === null) { $actionName = $this->node->getProperty('action'); if ($actionName === null || $actionName === '') { $actionName = $this->getAction() !== null ? $this->getAction() : 'index'; } $pluginRequest->setControllerActionName($actionName); } $pluginRequest->setArgument('__node', $this->node); $pluginRequest->setArgument('__documentNode', $this->documentNode); } else { $pluginRequest->setControllerPackageKey($this->getPackage()); $pluginRequest->setControllerSubpackageKey($this->getSubpackage()); $pluginRequest->setControllerName($this->getController()); $pluginRequest->setControllerActionName($this->getAction()); } foreach ($this->properties as $key => $value) { $pluginRequest->setArgument('__' . $key, $this->fusionValue($key)); } return $pluginRequest; }
[ "protected", "function", "buildPluginRequest", "(", ")", "{", "/** @var $parentRequest ActionRequest */", "$", "parentRequest", "=", "$", "this", "->", "runtime", "->", "getControllerContext", "(", ")", "->", "getRequest", "(", ")", ";", "$", "pluginRequest", "=", ...
Build the pluginRequest object @return ActionRequest
[ "Build", "the", "pluginRequest", "object" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/PluginImplementation.php#L95-L135
train
neos/neos-development-collection
Neos.Neos/Classes/Fusion/PluginImplementation.php
PluginImplementation.passArgumentsToPluginRequest
protected function passArgumentsToPluginRequest(ActionRequest $pluginRequest) { $arguments = $pluginRequest->getMainRequest()->getPluginArguments(); $pluginNamespace = $this->getPluginNamespace(); if (isset($arguments[$pluginNamespace])) { $pluginRequest->setArguments($arguments[$pluginNamespace]); } }
php
protected function passArgumentsToPluginRequest(ActionRequest $pluginRequest) { $arguments = $pluginRequest->getMainRequest()->getPluginArguments(); $pluginNamespace = $this->getPluginNamespace(); if (isset($arguments[$pluginNamespace])) { $pluginRequest->setArguments($arguments[$pluginNamespace]); } }
[ "protected", "function", "passArgumentsToPluginRequest", "(", "ActionRequest", "$", "pluginRequest", ")", "{", "$", "arguments", "=", "$", "pluginRequest", "->", "getMainRequest", "(", ")", "->", "getPluginArguments", "(", ")", ";", "$", "pluginNamespace", "=", "$...
Pass the arguments which were addressed to the plugin to its own request @param ActionRequest $pluginRequest The plugin request @return void
[ "Pass", "the", "arguments", "which", "were", "addressed", "to", "the", "plugin", "to", "its", "own", "request" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/PluginImplementation.php#L197-L204
train
neos/neos-development-collection
Neos.Neos/Classes/Fusion/Helper/CachingHelper.php
CachingHelper.convertArrayOfNodesToArrayOfNodeIdentifiersWithPrefix
protected function convertArrayOfNodesToArrayOfNodeIdentifiersWithPrefix($nodes, $prefix) { if ($nodes === null) { $nodes = []; } if (!is_array($nodes) && ($nodes instanceof NodeInterface || $nodes instanceof TraversableNodeInterface)) { $nodes = [$nodes]; } if (!is_array($nodes) && !$nodes instanceof \Traversable) { throw new Exception(sprintf('FlowQuery result, Array or Traversable expected by this helper, given: "%s".', gettype($nodes)), 1437169992); } $prefixedNodeIdentifiers = []; foreach ($nodes as $node) { if ($node instanceof NodeInterface) { /* @var $node NodeInterface */ $prefixedNodeIdentifiers[] = $prefix . '_' . $this->renderWorkspaceTagForContextNode($node->getContext()->getWorkspace()->getName()) . '_' . $node->getIdentifier(); } elseif ($node instanceof TraversableNodeInterface) { /* @var $node TraversableNodeInterface */ $prefixedNodeIdentifiers[] = $prefix . '_' . $this->renderWorkspaceTagForContextNode((string)$node->getContentStreamIdentifier()) . '_' . $node->getNodeAggregateIdentifier(); } else { throw new Exception(sprintf('One of the elements in array passed to this helper was not a Node, but of type: "%s".', gettype($node)), 1437169991); } } return $prefixedNodeIdentifiers; }
php
protected function convertArrayOfNodesToArrayOfNodeIdentifiersWithPrefix($nodes, $prefix) { if ($nodes === null) { $nodes = []; } if (!is_array($nodes) && ($nodes instanceof NodeInterface || $nodes instanceof TraversableNodeInterface)) { $nodes = [$nodes]; } if (!is_array($nodes) && !$nodes instanceof \Traversable) { throw new Exception(sprintf('FlowQuery result, Array or Traversable expected by this helper, given: "%s".', gettype($nodes)), 1437169992); } $prefixedNodeIdentifiers = []; foreach ($nodes as $node) { if ($node instanceof NodeInterface) { /* @var $node NodeInterface */ $prefixedNodeIdentifiers[] = $prefix . '_' . $this->renderWorkspaceTagForContextNode($node->getContext()->getWorkspace()->getName()) . '_' . $node->getIdentifier(); } elseif ($node instanceof TraversableNodeInterface) { /* @var $node TraversableNodeInterface */ $prefixedNodeIdentifiers[] = $prefix . '_' . $this->renderWorkspaceTagForContextNode((string)$node->getContentStreamIdentifier()) . '_' . $node->getNodeAggregateIdentifier(); } else { throw new Exception(sprintf('One of the elements in array passed to this helper was not a Node, but of type: "%s".', gettype($node)), 1437169991); } } return $prefixedNodeIdentifiers; }
[ "protected", "function", "convertArrayOfNodesToArrayOfNodeIdentifiersWithPrefix", "(", "$", "nodes", ",", "$", "prefix", ")", "{", "if", "(", "$", "nodes", "===", "null", ")", "{", "$", "nodes", "=", "[", "]", ";", "}", "if", "(", "!", "is_array", "(", "...
Render a caching configuration for array of Nodes @param mixed $nodes @param string $prefix @return array @throws Exception
[ "Render", "a", "caching", "configuration", "for", "array", "of", "Nodes" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Fusion/Helper/CachingHelper.php#L33-L60
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Domain/Model/ExpressionBasedNodeLabelGenerator.php
ExpressionBasedNodeLabelGenerator.getLabel
public function getLabel(\Neos\ContentRepository\Domain\Projection\Content\NodeInterface $node) { $label = Utility::evaluateEelExpression($this->getExpression(), $this->eelEvaluator, ['node' => $node], $this->defaultContextConfiguration); return $label; }
php
public function getLabel(\Neos\ContentRepository\Domain\Projection\Content\NodeInterface $node) { $label = Utility::evaluateEelExpression($this->getExpression(), $this->eelEvaluator, ['node' => $node], $this->defaultContextConfiguration); return $label; }
[ "public", "function", "getLabel", "(", "\\", "Neos", "\\", "ContentRepository", "\\", "Domain", "\\", "Projection", "\\", "Content", "\\", "NodeInterface", "$", "node", ")", "{", "$", "label", "=", "Utility", "::", "evaluateEelExpression", "(", "$", "this", ...
Render a node label @param \Neos\ContentRepository\Domain\Projection\Content\NodeInterface $node @return string @throws \Neos\Eel\Exception
[ "Render", "a", "node", "label" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Domain/Model/ExpressionBasedNodeLabelGenerator.php#L75-L79
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/DomainMatchingStrategy.php
DomainMatchingStrategy.getSortedMatches
public function getSortedMatches($hostnameToMatch, array $domains) { $matchingDomains = []; $matchQualities = []; $hostnameToMatchPartsReverse = array_reverse(explode('.', $hostnameToMatch)); foreach ($domains as $domain) { $domainHostname = $domain->getHostname(); if ($hostnameToMatch === $domainHostname) { $matchQuality = self::EXACTMATCH; } else { $matchQuality = 0; $domainHostnamePartsReverse = array_reverse(explode('.', $domainHostname)); foreach ($domainHostnamePartsReverse as $index => $domainHostnamePart) { if (isset($hostnameToMatchPartsReverse[$index]) && $domainHostnamePart === $hostnameToMatchPartsReverse[$index]) { $matchQuality++; } else { $matchQuality = self::NOMATCH; break; } } } if ($matchQuality > 0) { $matchingDomains[] = $domain; $matchQualities[] = $matchQuality; } } array_multisort($matchQualities, SORT_DESC, $matchingDomains); return $matchingDomains; }
php
public function getSortedMatches($hostnameToMatch, array $domains) { $matchingDomains = []; $matchQualities = []; $hostnameToMatchPartsReverse = array_reverse(explode('.', $hostnameToMatch)); foreach ($domains as $domain) { $domainHostname = $domain->getHostname(); if ($hostnameToMatch === $domainHostname) { $matchQuality = self::EXACTMATCH; } else { $matchQuality = 0; $domainHostnamePartsReverse = array_reverse(explode('.', $domainHostname)); foreach ($domainHostnamePartsReverse as $index => $domainHostnamePart) { if (isset($hostnameToMatchPartsReverse[$index]) && $domainHostnamePart === $hostnameToMatchPartsReverse[$index]) { $matchQuality++; } else { $matchQuality = self::NOMATCH; break; } } } if ($matchQuality > 0) { $matchingDomains[] = $domain; $matchQualities[] = $matchQuality; } } array_multisort($matchQualities, SORT_DESC, $matchingDomains); return $matchingDomains; }
[ "public", "function", "getSortedMatches", "(", "$", "hostnameToMatch", ",", "array", "$", "domains", ")", "{", "$", "matchingDomains", "=", "[", "]", ";", "$", "matchQualities", "=", "[", "]", ";", "$", "hostnameToMatchPartsReverse", "=", "array_reverse", "(",...
Returns those of the given domains which match the specified hostname. The domains are sorted by their match exactness. If none really matches an empty array is returned. @param string $hostnameToMatch The hostname to match against (eg. "localhost" or "www.neos.io") @param array<\Neos\Neos\Domain\Model\Domain> $domains The domains to check @return array The matching domains
[ "Returns", "those", "of", "the", "given", "domains", "which", "match", "the", "specified", "hostname", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/DomainMatchingStrategy.php#L36-L68
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/AssetSource/Neos/NeosAssetSource.php
NeosAssetSource.getPreviewUriForAsset
public function getPreviewUriForAsset(AssetInterface $asset): ?UriInterface { $actionRequest = ($this->asyncThumbnails ? $this->createActionRequest() : null); $thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset('Neos.Media.Browser:Preview', ($actionRequest !== null)); $thumbnailData = $this->assetService->getThumbnailUriAndSizeForAsset($asset, $thumbnailConfiguration, $actionRequest); return isset($thumbnailData['src']) ? new Uri($thumbnailData['src']) : null; }
php
public function getPreviewUriForAsset(AssetInterface $asset): ?UriInterface { $actionRequest = ($this->asyncThumbnails ? $this->createActionRequest() : null); $thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset('Neos.Media.Browser:Preview', ($actionRequest !== null)); $thumbnailData = $this->assetService->getThumbnailUriAndSizeForAsset($asset, $thumbnailConfiguration, $actionRequest); return isset($thumbnailData['src']) ? new Uri($thumbnailData['src']) : null; }
[ "public", "function", "getPreviewUriForAsset", "(", "AssetInterface", "$", "asset", ")", ":", "?", "UriInterface", "{", "$", "actionRequest", "=", "(", "$", "this", "->", "asyncThumbnails", "?", "$", "this", "->", "createActionRequest", "(", ")", ":", "null", ...
Internal method used by NeosAssetProxy @param AssetInterface $asset @return Uri|null @throws ThumbnailServiceException @throws AssetServiceException
[ "Internal", "method", "used", "by", "NeosAssetProxy" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/AssetSource/Neos/NeosAssetSource.php#L165-L171
train
neos/neos-development-collection
Neos.Neos/Classes/TypeConverter/EntityToIdentityConverter.php
EntityToIdentityConverter.canConvertFrom
public function canConvertFrom($source, $targetType) { $identifier = $this->persistenceManager->getIdentifierByObject($source); return ($identifier !== null); }
php
public function canConvertFrom($source, $targetType) { $identifier = $this->persistenceManager->getIdentifierByObject($source); return ($identifier !== null); }
[ "public", "function", "canConvertFrom", "(", "$", "source", ",", "$", "targetType", ")", "{", "$", "identifier", "=", "$", "this", "->", "persistenceManager", "->", "getIdentifierByObject", "(", "$", "source", ")", ";", "return", "(", "$", "identifier", "!==...
Check if the given object has an identity. @param object $source the source data @param string $targetType the type to convert to. @return boolean true if this TypeConverter can convert from $source to $targetType, false otherwise.
[ "Check", "if", "the", "given", "object", "has", "an", "identity", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/TypeConverter/EntityToIdentityConverter.php#L59-L63
train
neos/neos-development-collection
Neos.Neos/Classes/TypeConverter/EntityToIdentityConverter.php
EntityToIdentityConverter.convertFrom
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) { return [ '__identity' => $this->persistenceManager->getIdentifierByObject($source), '__type' => TypeHandling::getTypeForValue($source) ]; }
php
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) { return [ '__identity' => $this->persistenceManager->getIdentifierByObject($source), '__type' => TypeHandling::getTypeForValue($source) ]; }
[ "public", "function", "convertFrom", "(", "$", "source", ",", "$", "targetType", ",", "array", "$", "convertedChildProperties", "=", "[", "]", ",", "PropertyMappingConfigurationInterface", "$", "configuration", "=", "null", ")", "{", "return", "[", "'__identity'",...
Converts the given source object to an array containing the type and identity. @param object $source @param string $targetType @param array $convertedChildProperties @param PropertyMappingConfigurationInterface $configuration @return array
[ "Converts", "the", "given", "source", "object", "to", "an", "array", "containing", "the", "type", "and", "identity", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/TypeConverter/EntityToIdentityConverter.php#L75-L81
train
neos/neos-development-collection
Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php
WrapViewHelper.render
public function render(NodeInterface $node = null) { $view = $this->viewHelperVariableContainer->getView(); if (!$view instanceof FusionAwareViewInterface) { throw new ViewHelperException('This ViewHelper can only be used in a Fusion content element. You have to specify the "node" argument if it cannot be resolved from the Fusion context.', 1385737102); } $fusionObject = $view->getFusionObject(); $currentContext = $fusionObject->getRuntime()->getCurrentContext(); if ($node === null) { $node = $currentContext['node']; } return $this->contentElementWrappingService->wrapContentObject($node, $this->renderChildren(), $fusionObject->getPath()); }
php
public function render(NodeInterface $node = null) { $view = $this->viewHelperVariableContainer->getView(); if (!$view instanceof FusionAwareViewInterface) { throw new ViewHelperException('This ViewHelper can only be used in a Fusion content element. You have to specify the "node" argument if it cannot be resolved from the Fusion context.', 1385737102); } $fusionObject = $view->getFusionObject(); $currentContext = $fusionObject->getRuntime()->getCurrentContext(); if ($node === null) { $node = $currentContext['node']; } return $this->contentElementWrappingService->wrapContentObject($node, $this->renderChildren(), $fusionObject->getPath()); }
[ "public", "function", "render", "(", "NodeInterface", "$", "node", "=", "null", ")", "{", "$", "view", "=", "$", "this", "->", "viewHelperVariableContainer", "->", "getView", "(", ")", ";", "if", "(", "!", "$", "view", "instanceof", "FusionAwareViewInterface...
In live workspace this just renders a the content. For logged in users with access to the Backend this also adds the attributes for the RTE to work. @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", "the", "content", ".", "For", "logged", "in", "users", "with", "access", "to", "the", "Backend", "this", "also", "adds", "the", "attributes", "for", "the", "RTE", "to", "work", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php#L60-L73
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php
ResizeImageAdjustment.calculateDimensions
protected function calculateDimensions(BoxInterface $originalDimensions) { $newDimensions = clone $originalDimensions; switch (true) { // height and width are set explicitly: case ($this->width !== null && $this->height !== null): $newDimensions = $this->calculateWithFixedDimensions($originalDimensions, $this->width, $this->height); break; // only width is set explicitly: case ($this->width !== null): $newDimensions = $this->calculateScalingToWidth($originalDimensions, $this->width); break; // only height is set explicitly: case ($this->height !== null): $newDimensions = $this->calculateScalingToHeight($originalDimensions, $this->height); break; } // We apply maximum dimensions and scale the new dimensions proportionally down to fit into the maximum. if ($this->maximumWidth !== null && $newDimensions->getWidth() > $this->maximumWidth) { $newDimensions = $newDimensions->widen($this->maximumWidth); } if ($this->maximumHeight !== null && $newDimensions->getHeight() > $this->maximumHeight) { $newDimensions = $newDimensions->heighten($this->maximumHeight); } return $newDimensions; }
php
protected function calculateDimensions(BoxInterface $originalDimensions) { $newDimensions = clone $originalDimensions; switch (true) { // height and width are set explicitly: case ($this->width !== null && $this->height !== null): $newDimensions = $this->calculateWithFixedDimensions($originalDimensions, $this->width, $this->height); break; // only width is set explicitly: case ($this->width !== null): $newDimensions = $this->calculateScalingToWidth($originalDimensions, $this->width); break; // only height is set explicitly: case ($this->height !== null): $newDimensions = $this->calculateScalingToHeight($originalDimensions, $this->height); break; } // We apply maximum dimensions and scale the new dimensions proportionally down to fit into the maximum. if ($this->maximumWidth !== null && $newDimensions->getWidth() > $this->maximumWidth) { $newDimensions = $newDimensions->widen($this->maximumWidth); } if ($this->maximumHeight !== null && $newDimensions->getHeight() > $this->maximumHeight) { $newDimensions = $newDimensions->heighten($this->maximumHeight); } return $newDimensions; }
[ "protected", "function", "calculateDimensions", "(", "BoxInterface", "$", "originalDimensions", ")", "{", "$", "newDimensions", "=", "clone", "$", "originalDimensions", ";", "switch", "(", "true", ")", "{", "// height and width are set explicitly:", "case", "(", "$", ...
Calculates and returns the dimensions the image should have according all parameters set in this adjustment. @param BoxInterface $originalDimensions Dimensions of the unadjusted image @return BoxInterface
[ "Calculates", "and", "returns", "the", "dimensions", "the", "image", "should", "have", "according", "all", "parameters", "set", "in", "this", "adjustment", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php#L305-L334
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php
ResizeImageAdjustment.calculateOutboundBox
protected function calculateOutboundBox(BoxInterface $originalDimensions, $requestedWidth, $requestedHeight) { $newDimensions = new Box($requestedWidth, $requestedHeight); if ($this->getAllowUpScaling() === true || $originalDimensions->contains($newDimensions) === true) { return $newDimensions; } // We need to make sure that the new dimensions are such that no upscaling is needed. $ratios = [ $originalDimensions->getWidth() / $requestedWidth, $originalDimensions->getHeight() / $requestedHeight ]; $ratio = min($ratios); $newDimensions = $newDimensions->scale($ratio); return $newDimensions; }
php
protected function calculateOutboundBox(BoxInterface $originalDimensions, $requestedWidth, $requestedHeight) { $newDimensions = new Box($requestedWidth, $requestedHeight); if ($this->getAllowUpScaling() === true || $originalDimensions->contains($newDimensions) === true) { return $newDimensions; } // We need to make sure that the new dimensions are such that no upscaling is needed. $ratios = [ $originalDimensions->getWidth() / $requestedWidth, $originalDimensions->getHeight() / $requestedHeight ]; $ratio = min($ratios); $newDimensions = $newDimensions->scale($ratio); return $newDimensions; }
[ "protected", "function", "calculateOutboundBox", "(", "BoxInterface", "$", "originalDimensions", ",", "$", "requestedWidth", ",", "$", "requestedHeight", ")", "{", "$", "newDimensions", "=", "new", "Box", "(", "$", "requestedWidth", ",", "$", "requestedHeight", ")...
Calculate the final dimensions for an outbound box. usually exactly the requested width and height unless that would require upscaling and it is not allowed. @param BoxInterface $originalDimensions @param integer $requestedWidth @param integer $requestedHeight @return BoxInterface
[ "Calculate", "the", "final", "dimensions", "for", "an", "outbound", "box", ".", "usually", "exactly", "the", "requested", "width", "and", "height", "unless", "that", "would", "require", "upscaling", "and", "it", "is", "not", "allowed", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php#L376-L394
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php
ResizeImageAdjustment.calculateScalingToWidth
protected function calculateScalingToWidth(BoxInterface $originalDimensions, $requestedWidth) { if ($this->getAllowUpScaling() === false && $requestedWidth >= $originalDimensions->getWidth()) { return $originalDimensions; } $newDimensions = clone $originalDimensions; $newDimensions = $newDimensions->widen($requestedWidth); return $newDimensions; }
php
protected function calculateScalingToWidth(BoxInterface $originalDimensions, $requestedWidth) { if ($this->getAllowUpScaling() === false && $requestedWidth >= $originalDimensions->getWidth()) { return $originalDimensions; } $newDimensions = clone $originalDimensions; $newDimensions = $newDimensions->widen($requestedWidth); return $newDimensions; }
[ "protected", "function", "calculateScalingToWidth", "(", "BoxInterface", "$", "originalDimensions", ",", "$", "requestedWidth", ")", "{", "if", "(", "$", "this", "->", "getAllowUpScaling", "(", ")", "===", "false", "&&", "$", "requestedWidth", ">=", "$", "origin...
Calculates new dimensions with a requested width applied. Takes upscaling into consideration. @param BoxInterface $originalDimensions @param integer $requestedWidth @return BoxInterface
[ "Calculates", "new", "dimensions", "with", "a", "requested", "width", "applied", ".", "Takes", "upscaling", "into", "consideration", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php#L403-L413
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php
ResizeImageAdjustment.calculateScalingToHeight
protected function calculateScalingToHeight(BoxInterface $originalDimensions, $requestedHeight) { if ($this->getAllowUpScaling() === false && $requestedHeight >= $originalDimensions->getHeight()) { return $originalDimensions; } $newDimensions = clone $originalDimensions; $newDimensions = $newDimensions->heighten($requestedHeight); return $newDimensions; }
php
protected function calculateScalingToHeight(BoxInterface $originalDimensions, $requestedHeight) { if ($this->getAllowUpScaling() === false && $requestedHeight >= $originalDimensions->getHeight()) { return $originalDimensions; } $newDimensions = clone $originalDimensions; $newDimensions = $newDimensions->heighten($requestedHeight); return $newDimensions; }
[ "protected", "function", "calculateScalingToHeight", "(", "BoxInterface", "$", "originalDimensions", ",", "$", "requestedHeight", ")", "{", "if", "(", "$", "this", "->", "getAllowUpScaling", "(", ")", "===", "false", "&&", "$", "requestedHeight", ">=", "$", "ori...
Calculates new dimensions with a requested height applied. Takes upscaling into consideration. @param BoxInterface $originalDimensions @param integer $requestedHeight @return BoxInterface
[ "Calculates", "new", "dimensions", "with", "a", "requested", "height", "applied", ".", "Takes", "upscaling", "into", "consideration", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php#L422-L432
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php
ResizeImageAdjustment.resize
protected function resize(ImagineImageInterface $image, $mode = ImageInterface::RATIOMODE_INSET, $filter = ImagineImageInterface::FILTER_UNDEFINED) { if ($mode !== ImageInterface::RATIOMODE_INSET && $mode !== ImageInterface::RATIOMODE_OUTBOUND ) { throw new \InvalidArgumentException('Invalid mode specified'); } $imageSize = $image->getSize(); $requestedDimensions = $this->calculateDimensions($imageSize); $image->strip(); $resizeDimensions = $requestedDimensions; if ($mode === ImageInterface::RATIOMODE_OUTBOUND) { $resizeDimensions = $this->calculateOutboundScalingDimensions($imageSize, $requestedDimensions); } $image->resize($resizeDimensions, $filter); if ($mode === ImageInterface::RATIOMODE_OUTBOUND) { $image->crop(new Point( max(0, round(($resizeDimensions->getWidth() - $requestedDimensions->getWidth()) / 2)), max(0, round(($resizeDimensions->getHeight() - $requestedDimensions->getHeight()) / 2)) ), $requestedDimensions); } return $image; }
php
protected function resize(ImagineImageInterface $image, $mode = ImageInterface::RATIOMODE_INSET, $filter = ImagineImageInterface::FILTER_UNDEFINED) { if ($mode !== ImageInterface::RATIOMODE_INSET && $mode !== ImageInterface::RATIOMODE_OUTBOUND ) { throw new \InvalidArgumentException('Invalid mode specified'); } $imageSize = $image->getSize(); $requestedDimensions = $this->calculateDimensions($imageSize); $image->strip(); $resizeDimensions = $requestedDimensions; if ($mode === ImageInterface::RATIOMODE_OUTBOUND) { $resizeDimensions = $this->calculateOutboundScalingDimensions($imageSize, $requestedDimensions); } $image->resize($resizeDimensions, $filter); if ($mode === ImageInterface::RATIOMODE_OUTBOUND) { $image->crop(new Point( max(0, round(($resizeDimensions->getWidth() - $requestedDimensions->getWidth()) / 2)), max(0, round(($resizeDimensions->getHeight() - $requestedDimensions->getHeight()) / 2)) ), $requestedDimensions); } return $image; }
[ "protected", "function", "resize", "(", "ImagineImageInterface", "$", "image", ",", "$", "mode", "=", "ImageInterface", "::", "RATIOMODE_INSET", ",", "$", "filter", "=", "ImagineImageInterface", "::", "FILTER_UNDEFINED", ")", "{", "if", "(", "$", "mode", "!==", ...
Executes the actual resizing operation on the Imagine image. In case of an outbound resize the image will be resized and cropped. @param ImagineImageInterface $image @param string $mode @param string $filter @return \Imagine\Image\ManipulatorInterface
[ "Executes", "the", "actual", "resizing", "operation", "on", "the", "Imagine", "image", ".", "In", "case", "of", "an", "outbound", "resize", "the", "image", "will", "be", "resized", "and", "cropped", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php#L443-L471
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php
ResizeImageAdjustment.calculateOutboundScalingDimensions
protected function calculateOutboundScalingDimensions(BoxInterface $imageSize, BoxInterface $requestedDimensions) { $ratios = [ $requestedDimensions->getWidth() / $imageSize->getWidth(), $requestedDimensions->getHeight() / $imageSize->getHeight() ]; return $imageSize->scale(max($ratios)); }
php
protected function calculateOutboundScalingDimensions(BoxInterface $imageSize, BoxInterface $requestedDimensions) { $ratios = [ $requestedDimensions->getWidth() / $imageSize->getWidth(), $requestedDimensions->getHeight() / $imageSize->getHeight() ]; return $imageSize->scale(max($ratios)); }
[ "protected", "function", "calculateOutboundScalingDimensions", "(", "BoxInterface", "$", "imageSize", ",", "BoxInterface", "$", "requestedDimensions", ")", "{", "$", "ratios", "=", "[", "$", "requestedDimensions", "->", "getWidth", "(", ")", "/", "$", "imageSize", ...
Calculates a resize dimension box that allows for outbound resize. The scaled image will be bigger than the requested dimensions in one dimension and then cropped. @param BoxInterface $imageSize @param BoxInterface $requestedDimensions @return BoxInterface
[ "Calculates", "a", "resize", "dimension", "box", "that", "allows", "for", "outbound", "resize", ".", "The", "scaled", "image", "will", "be", "bigger", "than", "the", "requested", "dimensions", "in", "one", "dimension", "and", "then", "cropped", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php#L481-L489
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Repository/SiteRepository.php
SiteRepository.findDefault
public function findDefault() { if ($this->defaultSiteNodeName === null) { return $this->findOnline()->getFirst(); } /** * @var Site $defaultSite */ $defaultSite = $this->findOneByNodeName($this->defaultSiteNodeName); if (!$defaultSite instanceof Site || $defaultSite->getState() !== Site::STATE_ONLINE) { throw new NeosException(sprintf('DefaultSiteNode %s not found or not active', $this->defaultSiteNodeName), 1476374818); } return $defaultSite; }
php
public function findDefault() { if ($this->defaultSiteNodeName === null) { return $this->findOnline()->getFirst(); } /** * @var Site $defaultSite */ $defaultSite = $this->findOneByNodeName($this->defaultSiteNodeName); if (!$defaultSite instanceof Site || $defaultSite->getState() !== Site::STATE_ONLINE) { throw new NeosException(sprintf('DefaultSiteNode %s not found or not active', $this->defaultSiteNodeName), 1476374818); } return $defaultSite; }
[ "public", "function", "findDefault", "(", ")", "{", "if", "(", "$", "this", "->", "defaultSiteNodeName", "===", "null", ")", "{", "return", "$", "this", "->", "findOnline", "(", ")", "->", "getFirst", "(", ")", ";", "}", "/**\n * @var Site $defaultSi...
Find the site that was specified in the configuration ``defaultSiteNodeName`` If the defaultSiteNodeName-setting is null the first active site is returned If the site is not found or not active an exception is thrown @return Site @throws NeosException
[ "Find", "the", "site", "that", "was", "specified", "in", "the", "configuration", "defaultSiteNodeName" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Repository/SiteRepository.php#L75-L88
train
neos/neos-development-collection
Neos.Fusion/Classes/FusionObjects/ResourceUriImplementation.php
ResourceUriImplementation.evaluate
public function evaluate() { $resource = $this->getResource(); if ($resource !== null) { $uri = false; if ($resource instanceof PersistentResource) { $uri = $this->resourceManager->getPublicPersistentResourceUri($resource); } if ($uri === false) { throw new FusionException('The specified resource is invalid', 1386458728); } return $uri; } $path = $this->getPath(); if ($path === null) { throw new FusionException('Neither "resource" nor "path" were specified', 1386458763); } if (strpos($path, 'resource://') === 0) { $matches = []; if (preg_match('#^resource://([^/]+)/Public/(.*)#', $path, $matches) !== 1) { throw new FusionException(sprintf('The specified path "%s" does not point to a public resource.', $path), 1386458851); } $package = $matches[1]; $path = $matches[2]; } else { $package = $this->getPackage(); if ($package === null) { $controllerContext = $this->runtime->getControllerContext(); /** @var $actionRequest ActionRequest */ $actionRequest = $controllerContext->getRequest(); $package = $actionRequest->getControllerPackageKey(); } } $localize = $this->isLocalize(); if ($localize === true) { $resourcePath = 'resource://' . $package . '/Public/' . $path; $localizedResourcePathData = $this->i18nService->getLocalizedFilename($resourcePath); $matches = []; if (preg_match('#resource://([^/]+)/Public/(.*)#', current($localizedResourcePathData), $matches) === 1) { $package = $matches[1]; $path = $matches[2]; } } return $this->resourceManager->getPublicPackageResourceUri($package, $path); }
php
public function evaluate() { $resource = $this->getResource(); if ($resource !== null) { $uri = false; if ($resource instanceof PersistentResource) { $uri = $this->resourceManager->getPublicPersistentResourceUri($resource); } if ($uri === false) { throw new FusionException('The specified resource is invalid', 1386458728); } return $uri; } $path = $this->getPath(); if ($path === null) { throw new FusionException('Neither "resource" nor "path" were specified', 1386458763); } if (strpos($path, 'resource://') === 0) { $matches = []; if (preg_match('#^resource://([^/]+)/Public/(.*)#', $path, $matches) !== 1) { throw new FusionException(sprintf('The specified path "%s" does not point to a public resource.', $path), 1386458851); } $package = $matches[1]; $path = $matches[2]; } else { $package = $this->getPackage(); if ($package === null) { $controllerContext = $this->runtime->getControllerContext(); /** @var $actionRequest ActionRequest */ $actionRequest = $controllerContext->getRequest(); $package = $actionRequest->getControllerPackageKey(); } } $localize = $this->isLocalize(); if ($localize === true) { $resourcePath = 'resource://' . $package . '/Public/' . $path; $localizedResourcePathData = $this->i18nService->getLocalizedFilename($resourcePath); $matches = []; if (preg_match('#resource://([^/]+)/Public/(.*)#', current($localizedResourcePathData), $matches) === 1) { $package = $matches[1]; $path = $matches[2]; } } return $this->resourceManager->getPublicPackageResourceUri($package, $path); }
[ "public", "function", "evaluate", "(", ")", "{", "$", "resource", "=", "$", "this", "->", "getResource", "(", ")", ";", "if", "(", "$", "resource", "!==", "null", ")", "{", "$", "uri", "=", "false", ";", "if", "(", "$", "resource", "instanceof", "P...
Returns the absolute URL of a resource @return string @throws FusionException
[ "Returns", "the", "absolute", "URL", "of", "a", "resource" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/FusionObjects/ResourceUriImplementation.php#L92-L137
train
neos/neos-development-collection
Neos.Neos/Classes/EventLog/Domain/Repository/EventRepository.php
EventRepository.findRelevantEvents
public function findRelevantEvents($offset, $limit) { $query = $this->prepareRelevantEventsQuery(); $query->getQueryBuilder()->setFirstResult($offset); $query->getQueryBuilder()->setMaxResults($limit); return $query->execute(); }
php
public function findRelevantEvents($offset, $limit) { $query = $this->prepareRelevantEventsQuery(); $query->getQueryBuilder()->setFirstResult($offset); $query->getQueryBuilder()->setMaxResults($limit); return $query->execute(); }
[ "public", "function", "findRelevantEvents", "(", "$", "offset", ",", "$", "limit", ")", "{", "$", "query", "=", "$", "this", "->", "prepareRelevantEventsQuery", "(", ")", ";", "$", "query", "->", "getQueryBuilder", "(", ")", "->", "setFirstResult", "(", "$...
Find all events which are "top-level", i.e. do not have a parent event. @param integer $offset @param integer $limit @return QueryResultInterface @throws PropertyNotAccessibleException
[ "Find", "all", "events", "which", "are", "top", "-", "level", "i", ".", "e", ".", "do", "not", "have", "a", "parent", "event", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/EventLog/Domain/Repository/EventRepository.php#L65-L73
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Validator/AssetValidator.php
AssetValidator.initializeObject
protected function initializeObject() { $assetValidatorImplementationClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface(AssetValidatorInterface::class); foreach ($assetValidatorImplementationClassNames as $assetValidatorImplementationClassName) { $this->addValidator($this->objectManager->get($assetValidatorImplementationClassName)); } }
php
protected function initializeObject() { $assetValidatorImplementationClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface(AssetValidatorInterface::class); foreach ($assetValidatorImplementationClassNames as $assetValidatorImplementationClassName) { $this->addValidator($this->objectManager->get($assetValidatorImplementationClassName)); } }
[ "protected", "function", "initializeObject", "(", ")", "{", "$", "assetValidatorImplementationClassNames", "=", "$", "this", "->", "reflectionService", "->", "getAllImplementationClassNamesForInterface", "(", "AssetValidatorInterface", "::", "class", ")", ";", "foreach", ...
Adds all validators that extend the AssetValidatorInterface. @return void
[ "Adds", "all", "validators", "that", "extend", "the", "AssetValidatorInterface", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Validator/AssetValidator.php#L43-L49
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Migration/Transformations/StripTagsOnProperty.php
StripTagsOnProperty.execute
public function execute(NodeData $node) { $node->setProperty($this->propertyName, strip_tags($node->getProperty($this->propertyName))); }
php
public function execute(NodeData $node) { $node->setProperty($this->propertyName, strip_tags($node->getProperty($this->propertyName))); }
[ "public", "function", "execute", "(", "NodeData", "$", "node", ")", "{", "$", "node", "->", "setProperty", "(", "$", "this", "->", "propertyName", ",", "strip_tags", "(", "$", "node", "->", "getProperty", "(", "$", "this", "->", "propertyName", ")", ")",...
Strips tags on the value of the property to work on. @param NodeData $node @return void
[ "Strips", "tags", "on", "the", "value", "of", "the", "property", "to", "work", "on", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Transformations/StripTagsOnProperty.php#L56-L59
train
neos/neos-development-collection
Neos.Fusion/Classes/ViewHelpers/RenderViewHelper.php
RenderViewHelper.initializeFusionView
protected function initializeFusionView() { $this->fusionView = new FusionView(); $this->fusionView->setControllerContext($this->controllerContext); $this->fusionView->disableFallbackView(); if ($this->hasArgument('fusionFilePathPattern')) { $this->fusionView->setFusionPathPattern($this->arguments['fusionFilePathPattern']); } }
php
protected function initializeFusionView() { $this->fusionView = new FusionView(); $this->fusionView->setControllerContext($this->controllerContext); $this->fusionView->disableFallbackView(); if ($this->hasArgument('fusionFilePathPattern')) { $this->fusionView->setFusionPathPattern($this->arguments['fusionFilePathPattern']); } }
[ "protected", "function", "initializeFusionView", "(", ")", "{", "$", "this", "->", "fusionView", "=", "new", "FusionView", "(", ")", ";", "$", "this", "->", "fusionView", "->", "setControllerContext", "(", "$", "this", "->", "controllerContext", ")", ";", "$...
Initialize the Fusion View @return void
[ "Initialize", "the", "Fusion", "View" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/ViewHelpers/RenderViewHelper.php#L124-L132
train
neos/neos-development-collection
Neos.Neos/Classes/Service/NodeTypeSchemaBuilder.php
NodeTypeSchemaBuilder.generateConstraints
protected function generateConstraints() { $constraints = []; $nodeTypes = $this->nodeTypeManager->getNodeTypes(true); /** @var NodeType $nodeType */ foreach ($nodeTypes as $nodeTypeName => $nodeType) { $constraints[$nodeTypeName] = [ 'nodeTypes' => [], 'childNodes' => [] ]; foreach ($nodeTypes as $innerNodeTypeName => $innerNodeType) { if ($nodeType->allowsChildNodeType($innerNodeType)) { $constraints[$nodeTypeName]['nodeTypes'][$innerNodeTypeName] = true; } } foreach ($nodeType->getAutoCreatedChildNodes() as $key => $_x) { foreach ($nodeTypes as $innerNodeTypeName => $innerNodeType) { if ($nodeType->allowsGrandchildNodeType($key, $innerNodeType)) { $constraints[$nodeTypeName]['childNodes'][$key]['nodeTypes'][$innerNodeTypeName] = true; } } } } return $constraints; }
php
protected function generateConstraints() { $constraints = []; $nodeTypes = $this->nodeTypeManager->getNodeTypes(true); /** @var NodeType $nodeType */ foreach ($nodeTypes as $nodeTypeName => $nodeType) { $constraints[$nodeTypeName] = [ 'nodeTypes' => [], 'childNodes' => [] ]; foreach ($nodeTypes as $innerNodeTypeName => $innerNodeType) { if ($nodeType->allowsChildNodeType($innerNodeType)) { $constraints[$nodeTypeName]['nodeTypes'][$innerNodeTypeName] = true; } } foreach ($nodeType->getAutoCreatedChildNodes() as $key => $_x) { foreach ($nodeTypes as $innerNodeTypeName => $innerNodeType) { if ($nodeType->allowsGrandchildNodeType($key, $innerNodeType)) { $constraints[$nodeTypeName]['childNodes'][$key]['nodeTypes'][$innerNodeTypeName] = true; } } } } return $constraints; }
[ "protected", "function", "generateConstraints", "(", ")", "{", "$", "constraints", "=", "[", "]", ";", "$", "nodeTypes", "=", "$", "this", "->", "nodeTypeManager", "->", "getNodeTypes", "(", "true", ")", ";", "/** @var NodeType $nodeType */", "foreach", "(", "...
Generate the list of allowed sub-node-types per parent-node-type and child-node-name. @return array constraints
[ "Generate", "the", "list", "of", "allowed", "sub", "-", "node", "-", "types", "per", "parent", "-", "node", "-", "type", "and", "child", "-", "node", "-", "name", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/NodeTypeSchemaBuilder.php#L115-L141
train
neos/neos-development-collection
Neos.Media/Classes/Controller/ThumbnailController.php
ThumbnailController.thumbnailAction
public function thumbnailAction(Thumbnail $thumbnail) { if ($thumbnail->getResource() === null && $thumbnail->getStaticResource() === null) { $this->thumbnailService->refreshThumbnail($thumbnail); } $this->redirectToUri($this->thumbnailService->getUriForThumbnail($thumbnail), 0, 302); }
php
public function thumbnailAction(Thumbnail $thumbnail) { if ($thumbnail->getResource() === null && $thumbnail->getStaticResource() === null) { $this->thumbnailService->refreshThumbnail($thumbnail); } $this->redirectToUri($this->thumbnailService->getUriForThumbnail($thumbnail), 0, 302); }
[ "public", "function", "thumbnailAction", "(", "Thumbnail", "$", "thumbnail", ")", "{", "if", "(", "$", "thumbnail", "->", "getResource", "(", ")", "===", "null", "&&", "$", "thumbnail", "->", "getStaticResource", "(", ")", "===", "null", ")", "{", "$", "...
Generate thumbnail and redirect to resource URI @param Thumbnail $thumbnail @return void @throws StopActionException @throws UnsupportedRequestTypeException @throws ThumbnailServiceException
[ "Generate", "thumbnail", "and", "redirect", "to", "resource", "URI" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Controller/ThumbnailController.php#L44-L50
train
neos/neos-development-collection
Neos.Neos/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.generateUriPathSegments
public function generateUriPathSegments($workspaceName, $dryRun) { $baseContext = $this->createContext($workspaceName, []); $baseContextSitesNode = $baseContext->getNode(SiteService::SITES_ROOT_PATH); if (!$baseContextSitesNode) { $this->dispatch(self::EVENT_WARNING, sprintf('Could not find "%s" root node', SiteService::SITES_ROOT_PATH)); return; } $baseContextSiteNodes = $baseContextSitesNode->getChildNodes(); if ($baseContextSiteNodes === []) { $this->dispatch(self::EVENT_WARNING, sprintf('Could not find any site nodes in "%s" root node', SiteService::SITES_ROOT_PATH)); return; } foreach ($this->dimensionCombinator->getAllAllowedCombinations() as $dimensionCombination) { $flowQuery = new FlowQuery($baseContextSiteNodes); /** @noinspection PhpUndefinedMethodInspection */ $siteNodes = $flowQuery->context(['dimensions' => $dimensionCombination, 'targetDimensions' => []])->get(); if (count($siteNodes) > 0) { $this->dispatch(self::EVENT_NOTICE, sprintf('Checking for nodes with missing URI path segment in dimension "%s"', trim(NodePaths::generateContextPath('', '', $dimensionCombination), '@;'))); foreach ($siteNodes as $siteNode) { $this->generateUriPathSegmentsForNode($siteNode, $dryRun); } } } $this->persistenceManager->persistAll(); }
php
public function generateUriPathSegments($workspaceName, $dryRun) { $baseContext = $this->createContext($workspaceName, []); $baseContextSitesNode = $baseContext->getNode(SiteService::SITES_ROOT_PATH); if (!$baseContextSitesNode) { $this->dispatch(self::EVENT_WARNING, sprintf('Could not find "%s" root node', SiteService::SITES_ROOT_PATH)); return; } $baseContextSiteNodes = $baseContextSitesNode->getChildNodes(); if ($baseContextSiteNodes === []) { $this->dispatch(self::EVENT_WARNING, sprintf('Could not find any site nodes in "%s" root node', SiteService::SITES_ROOT_PATH)); return; } foreach ($this->dimensionCombinator->getAllAllowedCombinations() as $dimensionCombination) { $flowQuery = new FlowQuery($baseContextSiteNodes); /** @noinspection PhpUndefinedMethodInspection */ $siteNodes = $flowQuery->context(['dimensions' => $dimensionCombination, 'targetDimensions' => []])->get(); if (count($siteNodes) > 0) { $this->dispatch(self::EVENT_NOTICE, sprintf('Checking for nodes with missing URI path segment in dimension "%s"', trim(NodePaths::generateContextPath('', '', $dimensionCombination), '@;'))); foreach ($siteNodes as $siteNode) { $this->generateUriPathSegmentsForNode($siteNode, $dryRun); } } } $this->persistenceManager->persistAll(); }
[ "public", "function", "generateUriPathSegments", "(", "$", "workspaceName", ",", "$", "dryRun", ")", "{", "$", "baseContext", "=", "$", "this", "->", "createContext", "(", "$", "workspaceName", ",", "[", "]", ")", ";", "$", "baseContextSitesNode", "=", "$", ...
Generate missing URI path segments This generates URI path segment properties for all document nodes which don't have a path segment set yet. @param string $workspaceName @param boolean $dryRun @return void @throws EelException @throws NodeException @throws NeosException
[ "Generate", "missing", "URI", "path", "segments" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/NodeCommandControllerPlugin.php#L230-L257
train
neos/neos-development-collection
Neos.Neos/Classes/Command/NodeCommandControllerPlugin.php
NodeCommandControllerPlugin.generateUriPathSegmentsForNode
protected function generateUriPathSegmentsForNode(NodeInterface $node, $dryRun) { if ((string)$node->getProperty('uriPathSegment') === '') { $name = $node->getLabel() ?: $node->getName(); $uriPathSegment = $this->nodeUriPathSegmentGenerator->generateUriPathSegment($node); $taskDescription = sprintf('Add missing URI path segment for "<i>%s</i>" (<i>%s</i>) => <i>%s</i>', $node->getPath(), $name, $uriPathSegment); $taskClosure = function () use ($node, $uriPathSegment) { $node->setProperty('uriPathSegment', $uriPathSegment); }; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure); } foreach ($node->getChildNodes('Neos.Neos:Document') as $childNode) { $this->generateUriPathSegmentsForNode($childNode, $dryRun); } }
php
protected function generateUriPathSegmentsForNode(NodeInterface $node, $dryRun) { if ((string)$node->getProperty('uriPathSegment') === '') { $name = $node->getLabel() ?: $node->getName(); $uriPathSegment = $this->nodeUriPathSegmentGenerator->generateUriPathSegment($node); $taskDescription = sprintf('Add missing URI path segment for "<i>%s</i>" (<i>%s</i>) => <i>%s</i>', $node->getPath(), $name, $uriPathSegment); $taskClosure = function () use ($node, $uriPathSegment) { $node->setProperty('uriPathSegment', $uriPathSegment); }; $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure); } foreach ($node->getChildNodes('Neos.Neos:Document') as $childNode) { $this->generateUriPathSegmentsForNode($childNode, $dryRun); } }
[ "protected", "function", "generateUriPathSegmentsForNode", "(", "NodeInterface", "$", "node", ",", "$", "dryRun", ")", "{", "if", "(", "(", "string", ")", "$", "node", "->", "getProperty", "(", "'uriPathSegment'", ")", "===", "''", ")", "{", "$", "name", "...
Traverses through the tree starting at the given root node and sets the uriPathSegment property derived from the node label. @param NodeInterface $node The node where the traversal starts @param boolean $dryRun @return void @throws NodeException @throws NeosException
[ "Traverses", "through", "the", "tree", "starting", "at", "the", "given", "root", "node", "and", "sets", "the", "uriPathSegment", "property", "derived", "from", "the", "node", "label", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Command/NodeCommandControllerPlugin.php#L269-L283
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Migration/Filters/PropertyNotEmpty.php
PropertyNotEmpty.matches
public function matches(NodeData $node) { if ($node->hasProperty($this->propertyName)) { $propertyValue = $node->getProperty($this->propertyName); return !empty($propertyValue); } return false; }
php
public function matches(NodeData $node) { if ($node->hasProperty($this->propertyName)) { $propertyValue = $node->getProperty($this->propertyName); return !empty($propertyValue); } return false; }
[ "public", "function", "matches", "(", "NodeData", "$", "node", ")", "{", "if", "(", "$", "node", "->", "hasProperty", "(", "$", "this", "->", "propertyName", ")", ")", "{", "$", "propertyValue", "=", "$", "node", "->", "getProperty", "(", "$", "this", ...
Returns true if the given node has the property and the value is not empty. @param NodeData $node @return boolean
[ "Returns", "true", "if", "the", "given", "node", "has", "the", "property", "and", "the", "value", "is", "not", "empty", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Filters/PropertyNotEmpty.php#L45-L52
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.initializeView
protected function initializeView(ViewInterface $view): void { $view->assignMultiple([ 'view' => $this->browserState->get('view'), 'sortBy' => $this->browserState->get('sortBy'), 'sortDirection' => $this->browserState->get('sortDirection'), 'filter' => $this->browserState->get('filter'), 'activeTag' => $this->browserState->get('activeTag'), 'activeAssetCollection' => $this->browserState->get('activeAssetCollection'), 'assetSources' => $this->assetSources, 'variantsTabFeatureEnabled' => $this->settings['features']['variantsTab']['enable'] ]); }
php
protected function initializeView(ViewInterface $view): void { $view->assignMultiple([ 'view' => $this->browserState->get('view'), 'sortBy' => $this->browserState->get('sortBy'), 'sortDirection' => $this->browserState->get('sortDirection'), 'filter' => $this->browserState->get('filter'), 'activeTag' => $this->browserState->get('activeTag'), 'activeAssetCollection' => $this->browserState->get('activeAssetCollection'), 'assetSources' => $this->assetSources, 'variantsTabFeatureEnabled' => $this->settings['features']['variantsTab']['enable'] ]); }
[ "protected", "function", "initializeView", "(", "ViewInterface", "$", "view", ")", ":", "void", "{", "$", "view", "->", "assignMultiple", "(", "[", "'view'", "=>", "$", "this", "->", "browserState", "->", "get", "(", "'view'", ")", ",", "'sortBy'", "=>", ...
Set common variables on the view @param ViewInterface $view @return void
[ "Set", "common", "variables", "on", "the", "view" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L184-L196
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.newAction
public function newAction(): void { try { $maximumFileUploadSize = $this->getMaximumFileUploadSize(); } catch (FilesException $e) { $maximumFileUploadSize = null; } $this->view->assignMultiple([ 'tags' => $this->tagRepository->findAll(), 'assetCollections' => $this->assetCollectionRepository->findAll(), 'maximumFileUploadSize' => $maximumFileUploadSize, 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize) ]); }
php
public function newAction(): void { try { $maximumFileUploadSize = $this->getMaximumFileUploadSize(); } catch (FilesException $e) { $maximumFileUploadSize = null; } $this->view->assignMultiple([ 'tags' => $this->tagRepository->findAll(), 'assetCollections' => $this->assetCollectionRepository->findAll(), 'maximumFileUploadSize' => $maximumFileUploadSize, 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize) ]); }
[ "public", "function", "newAction", "(", ")", ":", "void", "{", "try", "{", "$", "maximumFileUploadSize", "=", "$", "this", "->", "getMaximumFileUploadSize", "(", ")", ";", "}", "catch", "(", "FilesException", "$", "e", ")", "{", "$", "maximumFileUploadSize",...
New asset form @return void
[ "New", "asset", "form" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L294-L308
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.showAction
public function showAction(string $assetSourceIdentifier, string $assetProxyIdentifier): void { if (!isset($this->assetSources[$assetSourceIdentifier])) { throw new \RuntimeException('Given asset source is not configured.', 1509702178); } $assetProxyRepository = $this->assetSources[$assetSourceIdentifier]->getAssetProxyRepository(); try { $assetProxy = $assetProxyRepository->getAssetProxy($assetProxyIdentifier); $this->view->assignMultiple([ 'assetProxy' => $assetProxy, 'assetCollections' => $this->assetCollectionRepository->findAll() ]); } catch (AssetNotFoundExceptionInterface $e) { $this->throwStatus(404, 'Asset not found'); } catch (AssetSourceConnectionExceptionInterface $e) { $this->view->assign('connectionError', $e); } }
php
public function showAction(string $assetSourceIdentifier, string $assetProxyIdentifier): void { if (!isset($this->assetSources[$assetSourceIdentifier])) { throw new \RuntimeException('Given asset source is not configured.', 1509702178); } $assetProxyRepository = $this->assetSources[$assetSourceIdentifier]->getAssetProxyRepository(); try { $assetProxy = $assetProxyRepository->getAssetProxy($assetProxyIdentifier); $this->view->assignMultiple([ 'assetProxy' => $assetProxy, 'assetCollections' => $this->assetCollectionRepository->findAll() ]); } catch (AssetNotFoundExceptionInterface $e) { $this->throwStatus(404, 'Asset not found'); } catch (AssetSourceConnectionExceptionInterface $e) { $this->view->assign('connectionError', $e); } }
[ "public", "function", "showAction", "(", "string", "$", "assetSourceIdentifier", ",", "string", "$", "assetProxyIdentifier", ")", ":", "void", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "assetSources", "[", "$", "assetSourceIdentifier", "]", ")", ...
Show an asset @param string $assetSourceIdentifier @param string $assetProxyIdentifier @return void @throws StopActionException @throws UnsupportedRequestTypeException
[ "Show", "an", "asset" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L339-L358
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.editAction
public function editAction(string $assetSourceIdentifier, string $assetProxyIdentifier): void { if (!isset($this->assetSources[$assetSourceIdentifier])) { throw new \RuntimeException('Given asset source is not configured.', 1509632166); } $assetSource = $this->assetSources[$assetSourceIdentifier]; $assetProxyRepository = $assetSource->getAssetProxyRepository(); try { $assetProxy = $assetProxyRepository->getAssetProxy($assetProxyIdentifier); $tags = []; $contentPreview = 'ContentDefault'; if ($assetProxyRepository instanceof SupportsTaggingInterface && $assetProxyRepository instanceof SupportsCollectionsInterface) { // TODO: For generic implementation (allowing other asset sources to provide asset collections), the following needs to be refactored: if ($assetProxy instanceof NeosAssetProxy) { /** @var Asset $asset */ $asset = $assetProxy->getAsset(); $assetCollections = $asset->getAssetCollections(); $tags = $assetCollections->count() > 0 ? $this->tagRepository->findByAssetCollections($assetCollections->toArray()) : $this->tagRepository->findAll(); switch ($asset->getFileExtension()) { case 'pdf': $contentPreview = 'ContentPdf'; break; } } } $this->view->assignMultiple([ 'tags' => $tags, 'assetProxy' => $assetProxy, 'assetCollections' => $this->assetCollectionRepository->findAll(), 'contentPreview' => $contentPreview, 'assetSource' => $assetSource, 'canShowVariants' => ($assetProxy instanceof NeosAssetProxy) && ($assetProxy->getAsset() instanceof VariantSupportInterface) ]); } catch (AssetNotFoundExceptionInterface $e) { $this->throwStatus(404, 'Asset not found'); } catch (AssetSourceConnectionExceptionInterface $e) { $this->view->assign('connectionError', $e); } }
php
public function editAction(string $assetSourceIdentifier, string $assetProxyIdentifier): void { if (!isset($this->assetSources[$assetSourceIdentifier])) { throw new \RuntimeException('Given asset source is not configured.', 1509632166); } $assetSource = $this->assetSources[$assetSourceIdentifier]; $assetProxyRepository = $assetSource->getAssetProxyRepository(); try { $assetProxy = $assetProxyRepository->getAssetProxy($assetProxyIdentifier); $tags = []; $contentPreview = 'ContentDefault'; if ($assetProxyRepository instanceof SupportsTaggingInterface && $assetProxyRepository instanceof SupportsCollectionsInterface) { // TODO: For generic implementation (allowing other asset sources to provide asset collections), the following needs to be refactored: if ($assetProxy instanceof NeosAssetProxy) { /** @var Asset $asset */ $asset = $assetProxy->getAsset(); $assetCollections = $asset->getAssetCollections(); $tags = $assetCollections->count() > 0 ? $this->tagRepository->findByAssetCollections($assetCollections->toArray()) : $this->tagRepository->findAll(); switch ($asset->getFileExtension()) { case 'pdf': $contentPreview = 'ContentPdf'; break; } } } $this->view->assignMultiple([ 'tags' => $tags, 'assetProxy' => $assetProxy, 'assetCollections' => $this->assetCollectionRepository->findAll(), 'contentPreview' => $contentPreview, 'assetSource' => $assetSource, 'canShowVariants' => ($assetProxy instanceof NeosAssetProxy) && ($assetProxy->getAsset() instanceof VariantSupportInterface) ]); } catch (AssetNotFoundExceptionInterface $e) { $this->throwStatus(404, 'Asset not found'); } catch (AssetSourceConnectionExceptionInterface $e) { $this->view->assign('connectionError', $e); } }
[ "public", "function", "editAction", "(", "string", "$", "assetSourceIdentifier", ",", "string", "$", "assetProxyIdentifier", ")", ":", "void", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "assetSources", "[", "$", "assetSourceIdentifier", "]", ")", ...
Edit an asset @param string $assetSourceIdentifier @param string $assetProxyIdentifier @return void @throws StopActionException @throws UnsupportedRequestTypeException
[ "Edit", "an", "asset" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L369-L413
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.variantsAction
public function variantsAction(string $assetSourceIdentifier, string $assetProxyIdentifier, string $overviewAction): void { if (!isset($this->assetSources[$assetSourceIdentifier])) { throw new \RuntimeException('Given asset source is not configured.', 1509632166); } $assetSource = $this->assetSources[$assetSourceIdentifier]; $assetProxyRepository = $assetSource->getAssetProxyRepository(); try { $assetProxy = $assetProxyRepository->getAssetProxy($assetProxyIdentifier); $asset = $this->persistenceManager->getObjectByIdentifier($assetProxy->getLocalAssetIdentifier(), Asset::class); /** @var VariantSupportInterface $originalAsset */ $originalAsset = ($asset instanceof AssetVariantInterface ? $asset->getOriginalAsset() : $asset); $variantInformation = array_map(static function (AssetVariantInterface $imageVariant) { return (new ImageMapper($imageVariant))->getMappingResult(); }, $originalAsset->getVariants()); $this->view->assignMultiple([ 'assetProxy' => $assetProxy, 'asset' => $originalAsset, 'assetSource' => $assetSource, 'imageProfiles' => $this->imageProfilesConfiguration, 'overviewAction' => $overviewAction, 'originalInformation' => (new ImageMapper($asset))->getMappingResult(), 'variantsInformation' => $variantInformation ]); } catch (AssetNotFoundExceptionInterface $e) { $this->throwStatus(404, 'Original asset not found'); } catch (AssetSourceConnectionExceptionInterface $e) { $this->view->assign('connectionError', $e); } }
php
public function variantsAction(string $assetSourceIdentifier, string $assetProxyIdentifier, string $overviewAction): void { if (!isset($this->assetSources[$assetSourceIdentifier])) { throw new \RuntimeException('Given asset source is not configured.', 1509632166); } $assetSource = $this->assetSources[$assetSourceIdentifier]; $assetProxyRepository = $assetSource->getAssetProxyRepository(); try { $assetProxy = $assetProxyRepository->getAssetProxy($assetProxyIdentifier); $asset = $this->persistenceManager->getObjectByIdentifier($assetProxy->getLocalAssetIdentifier(), Asset::class); /** @var VariantSupportInterface $originalAsset */ $originalAsset = ($asset instanceof AssetVariantInterface ? $asset->getOriginalAsset() : $asset); $variantInformation = array_map(static function (AssetVariantInterface $imageVariant) { return (new ImageMapper($imageVariant))->getMappingResult(); }, $originalAsset->getVariants()); $this->view->assignMultiple([ 'assetProxy' => $assetProxy, 'asset' => $originalAsset, 'assetSource' => $assetSource, 'imageProfiles' => $this->imageProfilesConfiguration, 'overviewAction' => $overviewAction, 'originalInformation' => (new ImageMapper($asset))->getMappingResult(), 'variantsInformation' => $variantInformation ]); } catch (AssetNotFoundExceptionInterface $e) { $this->throwStatus(404, 'Original asset not found'); } catch (AssetSourceConnectionExceptionInterface $e) { $this->view->assign('connectionError', $e); } }
[ "public", "function", "variantsAction", "(", "string", "$", "assetSourceIdentifier", ",", "string", "$", "assetProxyIdentifier", ",", "string", "$", "overviewAction", ")", ":", "void", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "assetSources", "[", ...
Display variants of an asset @param string $assetSourceIdentifier @param string $assetProxyIdentifier @param string $overviewAction @throws StopActionException @throws UnsupportedRequestTypeException
[ "Display", "variants", "of", "an", "asset" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L424-L458
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.updateAction
public function updateAction(Asset $asset): void { $this->assetRepository->update($asset); $this->addFlashMessage('assetHasBeenUpdated', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]); $this->redirect('index'); }
php
public function updateAction(Asset $asset): void { $this->assetRepository->update($asset); $this->addFlashMessage('assetHasBeenUpdated', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]); $this->redirect('index'); }
[ "public", "function", "updateAction", "(", "Asset", "$", "asset", ")", ":", "void", "{", "$", "this", "->", "assetRepository", "->", "update", "(", "$", "asset", ")", ";", "$", "this", "->", "addFlashMessage", "(", "'assetHasBeenUpdated'", ",", "''", ",", ...
Update an asset @param Asset $asset @return void @throws StopActionException @throws IllegalObjectTypeException
[ "Update", "an", "asset" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L479-L484
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.initializeCreateAction
protected function initializeCreateAction(): void { $assetMappingConfiguration = $this->arguments->getArgument('asset')->getPropertyMappingConfiguration(); $assetMappingConfiguration->allowProperties('title', 'resource', 'tags', 'assetCollections'); $assetMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); $assetMappingConfiguration->setTypeConverterOption(AssetInterfaceConverter::class, AssetInterfaceConverter::CONFIGURATION_ONE_PER_RESOURCE, true); }
php
protected function initializeCreateAction(): void { $assetMappingConfiguration = $this->arguments->getArgument('asset')->getPropertyMappingConfiguration(); $assetMappingConfiguration->allowProperties('title', 'resource', 'tags', 'assetCollections'); $assetMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); $assetMappingConfiguration->setTypeConverterOption(AssetInterfaceConverter::class, AssetInterfaceConverter::CONFIGURATION_ONE_PER_RESOURCE, true); }
[ "protected", "function", "initializeCreateAction", "(", ")", ":", "void", "{", "$", "assetMappingConfiguration", "=", "$", "this", "->", "arguments", "->", "getArgument", "(", "'asset'", ")", "->", "getPropertyMappingConfiguration", "(", ")", ";", "$", "assetMappi...
Initialization for createAction @return void @throws NoSuchArgumentException
[ "Initialization", "for", "createAction" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L492-L498
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.createAction
public function createAction(Asset $asset): void { if ($this->persistenceManager->isNewObject($asset)) { $this->assetRepository->add($asset); } $this->addFlashMessage('assetHasBeenAdded', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]); $this->redirect('index'); }
php
public function createAction(Asset $asset): void { if ($this->persistenceManager->isNewObject($asset)) { $this->assetRepository->add($asset); } $this->addFlashMessage('assetHasBeenAdded', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]); $this->redirect('index'); }
[ "public", "function", "createAction", "(", "Asset", "$", "asset", ")", ":", "void", "{", "if", "(", "$", "this", "->", "persistenceManager", "->", "isNewObject", "(", "$", "asset", ")", ")", "{", "$", "this", "->", "assetRepository", "->", "add", "(", ...
Create a new asset @param Asset $asset @return void @throws StopActionException @throws IllegalObjectTypeException
[ "Create", "a", "new", "asset" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L508-L515
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.tagAssetAction
public function tagAssetAction(Asset $asset, Tag $tag): void { $success = false; if ($asset->addTag($tag)) { $this->assetRepository->update($asset); $success = true; } $this->view->assign('value', $success); }
php
public function tagAssetAction(Asset $asset, Tag $tag): void { $success = false; if ($asset->addTag($tag)) { $this->assetRepository->update($asset); $success = true; } $this->view->assign('value', $success); }
[ "public", "function", "tagAssetAction", "(", "Asset", "$", "asset", ",", "Tag", "$", "tag", ")", ":", "void", "{", "$", "success", "=", "false", ";", "if", "(", "$", "asset", "->", "addTag", "(", "$", "tag", ")", ")", "{", "$", "this", "->", "ass...
Tags an asset with a tag. No redirection and no response body, no flash message, for use by plupload (or similar). @param Asset $asset @param Tag $tag @return void @throws IllegalObjectTypeException
[ "Tags", "an", "asset", "with", "a", "tag", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L569-L577
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.addAssetToCollectionAction
public function addAssetToCollectionAction(Asset $asset, AssetCollection $assetCollection): void { $success = false; if ($assetCollection->addAsset($asset)) { $this->assetCollectionRepository->update($assetCollection); $success = true; } $this->view->assign('value', $success); }
php
public function addAssetToCollectionAction(Asset $asset, AssetCollection $assetCollection): void { $success = false; if ($assetCollection->addAsset($asset)) { $this->assetCollectionRepository->update($assetCollection); $success = true; } $this->view->assign('value', $success); }
[ "public", "function", "addAssetToCollectionAction", "(", "Asset", "$", "asset", ",", "AssetCollection", "$", "assetCollection", ")", ":", "void", "{", "$", "success", "=", "false", ";", "if", "(", "$", "assetCollection", "->", "addAsset", "(", "$", "asset", ...
Adds an asset to an asset collection @param Asset $asset @param AssetCollection $assetCollection @return void @throws IllegalObjectTypeException
[ "Adds", "an", "asset", "to", "an", "asset", "collection" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L587-L595
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.deleteAction
public function deleteAction(Asset $asset): void { $usageReferences = $this->assetService->getUsageReferences($asset); if (count($usageReferences) > 0) { $this->addFlashMessage('deleteRelatedNodes', '', Message::SEVERITY_WARNING, [], 1412422767); $this->redirect('index'); } $this->assetRepository->remove($asset); $this->addFlashMessage('assetHasBeenDeleted', '', Message::SEVERITY_OK, [$asset->getLabel()], 1412375050); $this->redirect('index'); }
php
public function deleteAction(Asset $asset): void { $usageReferences = $this->assetService->getUsageReferences($asset); if (count($usageReferences) > 0) { $this->addFlashMessage('deleteRelatedNodes', '', Message::SEVERITY_WARNING, [], 1412422767); $this->redirect('index'); } $this->assetRepository->remove($asset); $this->addFlashMessage('assetHasBeenDeleted', '', Message::SEVERITY_OK, [$asset->getLabel()], 1412375050); $this->redirect('index'); }
[ "public", "function", "deleteAction", "(", "Asset", "$", "asset", ")", ":", "void", "{", "$", "usageReferences", "=", "$", "this", "->", "assetService", "->", "getUsageReferences", "(", "$", "asset", ")", ";", "if", "(", "count", "(", "$", "usageReferences...
Delete an asset @param Asset $asset @return void @throws IllegalObjectTypeException @throws StopActionException @throws AssetServiceException
[ "Delete", "an", "asset" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L606-L617
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.updateAssetResourceAction
public function updateAssetResourceAction(AssetInterface $asset, PersistentResource $resource, array $options = []): void { $sourceMediaType = MediaTypes::parseMediaType($asset->getMediaType()); $replacementMediaType = MediaTypes::parseMediaType($resource->getMediaType()); // Prevent replacement of image, audio and video by a different mimetype because of possible rendering issues. if ($sourceMediaType['type'] !== $replacementMediaType['type'] && in_array($sourceMediaType['type'], ['image', 'audio', 'video'])) { $this->addFlashMessage( 'resourceCanOnlyBeReplacedBySimilarResource', '', Message::SEVERITY_WARNING, [$sourceMediaType['type'], $resource->getMediaType()], 1462308179 ); $this->redirect('index'); } try { $this->assetService->replaceAssetResource($asset, $resource, $options); } catch (\Exception $exception) { $this->addFlashMessage('couldNotReplaceAsset', '', Message::SEVERITY_OK, [], 1463472606); $this->forwardToReferringRequest(); return; } $assetLabel = (method_exists($asset, 'getLabel') ? $asset->getLabel() : $resource->getFilename()); $this->addFlashMessage('assetHasBeenReplaced', '', Message::SEVERITY_OK, [htmlspecialchars($assetLabel)]); $this->redirect('index'); }
php
public function updateAssetResourceAction(AssetInterface $asset, PersistentResource $resource, array $options = []): void { $sourceMediaType = MediaTypes::parseMediaType($asset->getMediaType()); $replacementMediaType = MediaTypes::parseMediaType($resource->getMediaType()); // Prevent replacement of image, audio and video by a different mimetype because of possible rendering issues. if ($sourceMediaType['type'] !== $replacementMediaType['type'] && in_array($sourceMediaType['type'], ['image', 'audio', 'video'])) { $this->addFlashMessage( 'resourceCanOnlyBeReplacedBySimilarResource', '', Message::SEVERITY_WARNING, [$sourceMediaType['type'], $resource->getMediaType()], 1462308179 ); $this->redirect('index'); } try { $this->assetService->replaceAssetResource($asset, $resource, $options); } catch (\Exception $exception) { $this->addFlashMessage('couldNotReplaceAsset', '', Message::SEVERITY_OK, [], 1463472606); $this->forwardToReferringRequest(); return; } $assetLabel = (method_exists($asset, 'getLabel') ? $asset->getLabel() : $resource->getFilename()); $this->addFlashMessage('assetHasBeenReplaced', '', Message::SEVERITY_OK, [htmlspecialchars($assetLabel)]); $this->redirect('index'); }
[ "public", "function", "updateAssetResourceAction", "(", "AssetInterface", "$", "asset", ",", "PersistentResource", "$", "resource", ",", "array", "$", "options", "=", "[", "]", ")", ":", "void", "{", "$", "sourceMediaType", "=", "MediaTypes", "::", "parseMediaTy...
Update the resource on an asset. @param AssetInterface $asset @param PersistentResource $resource @param array $options @return void @throws StopActionException @throws ForwardException
[ "Update", "the", "resource", "on", "an", "asset", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L629-L657
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.errorAction
protected function errorAction(): string { foreach ($this->arguments->getValidationResults()->getFlattenedErrors() as $propertyPath => $errors) { foreach ($errors as $error) { $this->flashMessageContainer->addMessage($error); } } return parent::errorAction(); }
php
protected function errorAction(): string { foreach ($this->arguments->getValidationResults()->getFlattenedErrors() as $propertyPath => $errors) { foreach ($errors as $error) { $this->flashMessageContainer->addMessage($error); } } return parent::errorAction(); }
[ "protected", "function", "errorAction", "(", ")", ":", "string", "{", "foreach", "(", "$", "this", "->", "arguments", "->", "getValidationResults", "(", ")", "->", "getFlattenedErrors", "(", ")", "as", "$", "propertyPath", "=>", "$", "errors", ")", "{", "f...
This custom errorAction adds FlashMessages for validation results to give more information in the @return string
[ "This", "custom", "errorAction", "adds", "FlashMessages", "for", "validation", "results", "to", "give", "more", "information", "in", "the" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L784-L793
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.getErrorFlashMessage
protected function getErrorFlashMessage() { if ($this->arguments->getValidationResults()->hasErrors()) { return false; } $errorMessage = 'An error occurred'; if ($this->objectManager->getContext()->isDevelopment()) { $errorMessage .= ' while trying to call %1$s->%2$s()'; } return new Error($errorMessage, null, [get_class($this), $this->actionMethodName]); }
php
protected function getErrorFlashMessage() { if ($this->arguments->getValidationResults()->hasErrors()) { return false; } $errorMessage = 'An error occurred'; if ($this->objectManager->getContext()->isDevelopment()) { $errorMessage .= ' while trying to call %1$s->%2$s()'; } return new Error($errorMessage, null, [get_class($this), $this->actionMethodName]); }
[ "protected", "function", "getErrorFlashMessage", "(", ")", "{", "if", "(", "$", "this", "->", "arguments", "->", "getValidationResults", "(", ")", "->", "hasErrors", "(", ")", ")", "{", "return", "false", ";", "}", "$", "errorMessage", "=", "'An error occurr...
Individual error FlashMessage that hides which action fails in production. @return Message|bool The flash message or false if no flash message should be set
[ "Individual", "error", "FlashMessage", "that", "hides", "which", "action", "fails", "in", "production", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L800-L811
train
neos/neos-development-collection
Neos.Media.Browser/Classes/Controller/AssetController.php
AssetController.addFlashMessage
public function addFlashMessage($messageBody, $messageTitle = '', $severity = Message::SEVERITY_OK, array $messageArguments = [], $messageCode = null): void { if (is_string($messageBody)) { $messageBody = $this->translator->translateById($messageBody, $messageArguments, null, null, 'Main', 'Neos.Media.Browser') ?: $messageBody; } $messageTitle = $this->translator->translateById($messageTitle, $messageArguments, null, null, 'Main', 'Neos.Media.Browser'); parent::addFlashMessage($messageBody, $messageTitle, $severity, $messageArguments, $messageCode); }
php
public function addFlashMessage($messageBody, $messageTitle = '', $severity = Message::SEVERITY_OK, array $messageArguments = [], $messageCode = null): void { if (is_string($messageBody)) { $messageBody = $this->translator->translateById($messageBody, $messageArguments, null, null, 'Main', 'Neos.Media.Browser') ?: $messageBody; } $messageTitle = $this->translator->translateById($messageTitle, $messageArguments, null, null, 'Main', 'Neos.Media.Browser'); parent::addFlashMessage($messageBody, $messageTitle, $severity, $messageArguments, $messageCode); }
[ "public", "function", "addFlashMessage", "(", "$", "messageBody", ",", "$", "messageTitle", "=", "''", ",", "$", "severity", "=", "Message", "::", "SEVERITY_OK", ",", "array", "$", "messageArguments", "=", "[", "]", ",", "$", "messageCode", "=", "null", ")...
Add a translated flashMessage. @param string $messageBody The translation id for the message body. @param string $messageTitle The translation id for the message title. @param string $severity @param array $messageArguments @param integer $messageCode @return void
[ "Add", "a", "translated", "flashMessage", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media.Browser/Classes/Controller/AssetController.php#L823-L831
train
neos/neos-development-collection
Neos.Fusion/Classes/View/FusionView.php
FusionView.setOption
public function setOption($optionName, $value) { $this->fusionPath = null; parent::setOption($optionName, $value); }
php
public function setOption($optionName, $value) { $this->fusionPath = null; parent::setOption($optionName, $value); }
[ "public", "function", "setOption", "(", "$", "optionName", ",", "$", "value", ")", "{", "$", "this", "->", "fusionPath", "=", "null", ";", "parent", "::", "setOption", "(", "$", "optionName", ",", "$", "value", ")", ";", "}" ]
Reset runtime cache if an option is changed @param string $optionName @param mixed $value @return void
[ "Reset", "runtime", "cache", "if", "an", "option", "is", "changed" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/View/FusionView.php#L96-L100
train
neos/neos-development-collection
Neos.Fusion/Classes/View/FusionView.php
FusionView.initializeFusionRuntime
public function initializeFusionRuntime() { if ($this->fusionRuntime === null) { $this->loadFusion(); $this->fusionRuntime = new Runtime($this->parsedFusion, $this->controllerContext); } if (isset($this->options['debugMode'])) { $this->fusionRuntime->setDebugMode($this->options['debugMode']); } if (isset($this->options['enableContentCache'])) { $this->fusionRuntime->setEnableContentCache($this->options['enableContentCache']); } }
php
public function initializeFusionRuntime() { if ($this->fusionRuntime === null) { $this->loadFusion(); $this->fusionRuntime = new Runtime($this->parsedFusion, $this->controllerContext); } if (isset($this->options['debugMode'])) { $this->fusionRuntime->setDebugMode($this->options['debugMode']); } if (isset($this->options['enableContentCache'])) { $this->fusionRuntime->setEnableContentCache($this->options['enableContentCache']); } }
[ "public", "function", "initializeFusionRuntime", "(", ")", "{", "if", "(", "$", "this", "->", "fusionRuntime", "===", "null", ")", "{", "$", "this", "->", "loadFusion", "(", ")", ";", "$", "this", "->", "fusionRuntime", "=", "new", "Runtime", "(", "$", ...
Load the Fusion Files form the defined paths and construct a Runtime from the parsed results @return void
[ "Load", "the", "Fusion", "Files", "form", "the", "defined", "paths", "and", "construct", "a", "Runtime", "from", "the", "parsed", "results" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/View/FusionView.php#L189-L201
train
neos/neos-development-collection
Neos.Fusion/Classes/View/FusionView.php
FusionView.getFusionPathForCurrentRequest
protected function getFusionPathForCurrentRequest() { if ($this->fusionPath === null) { $fusionPath = $this->getOption('fusionPath'); if ($fusionPath !== null) { $this->fusionPath = $fusionPath; } else { /** @var $request ActionRequest */ $request = $this->controllerContext->getRequest(); $fusionPathForCurrentRequest = $request->getControllerObjectName(); $fusionPathForCurrentRequest = str_replace('\\Controller\\', '\\', $fusionPathForCurrentRequest); $fusionPathForCurrentRequest = str_replace('\\', '/', $fusionPathForCurrentRequest); $fusionPathForCurrentRequest = trim($fusionPathForCurrentRequest, '/'); $fusionPathForCurrentRequest .= '/' . $request->getControllerActionName(); $this->fusionPath = $fusionPathForCurrentRequest; } } return $this->fusionPath; }
php
protected function getFusionPathForCurrentRequest() { if ($this->fusionPath === null) { $fusionPath = $this->getOption('fusionPath'); if ($fusionPath !== null) { $this->fusionPath = $fusionPath; } else { /** @var $request ActionRequest */ $request = $this->controllerContext->getRequest(); $fusionPathForCurrentRequest = $request->getControllerObjectName(); $fusionPathForCurrentRequest = str_replace('\\Controller\\', '\\', $fusionPathForCurrentRequest); $fusionPathForCurrentRequest = str_replace('\\', '/', $fusionPathForCurrentRequest); $fusionPathForCurrentRequest = trim($fusionPathForCurrentRequest, '/'); $fusionPathForCurrentRequest .= '/' . $request->getControllerActionName(); $this->fusionPath = $fusionPathForCurrentRequest; } } return $this->fusionPath; }
[ "protected", "function", "getFusionPathForCurrentRequest", "(", ")", "{", "if", "(", "$", "this", "->", "fusionPath", "===", "null", ")", "{", "$", "fusionPath", "=", "$", "this", "->", "getOption", "(", "'fusionPath'", ")", ";", "if", "(", "$", "fusionPat...
Determines the Fusion path depending on the current controller and action @return string
[ "Determines", "the", "Fusion", "path", "depending", "on", "the", "current", "controller", "and", "action" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/View/FusionView.php#L248-L267
train
neos/neos-development-collection
Neos.Fusion/Classes/View/FusionView.php
FusionView.renderFusion
protected function renderFusion() { $this->fusionRuntime->pushContextArray($this->variables); try { $output = $this->fusionRuntime->render($this->getFusionPathForCurrentRequest()); } catch (RuntimeException $exception) { throw $exception->getPrevious(); } $this->fusionRuntime->popContext(); return $output; }
php
protected function renderFusion() { $this->fusionRuntime->pushContextArray($this->variables); try { $output = $this->fusionRuntime->render($this->getFusionPathForCurrentRequest()); } catch (RuntimeException $exception) { throw $exception->getPrevious(); } $this->fusionRuntime->popContext(); return $output; }
[ "protected", "function", "renderFusion", "(", ")", "{", "$", "this", "->", "fusionRuntime", "->", "pushContextArray", "(", "$", "this", "->", "variables", ")", ";", "try", "{", "$", "output", "=", "$", "this", "->", "fusionRuntime", "->", "render", "(", ...
Render the given Fusion and return the rendered page @return string @throws \Exception
[ "Render", "the", "given", "Fusion", "and", "return", "the", "rendered", "page" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/View/FusionView.php#L274-L284
train
neos/neos-development-collection
Neos.Fusion/Classes/View/FusionView.php
FusionView.renderFallbackView
public function renderFallbackView() { $this->fallbackView->setControllerContext($this->controllerContext); $this->fallbackView->assignMultiple($this->variables); return $this->fallbackView->render(); }
php
public function renderFallbackView() { $this->fallbackView->setControllerContext($this->controllerContext); $this->fallbackView->assignMultiple($this->variables); return $this->fallbackView->render(); }
[ "public", "function", "renderFallbackView", "(", ")", "{", "$", "this", "->", "fallbackView", "->", "setControllerContext", "(", "$", "this", "->", "controllerContext", ")", ";", "$", "this", "->", "fallbackView", "->", "assignMultiple", "(", "$", "this", "->"...
Initialize and render the fallback view @return string
[ "Initialize", "and", "render", "the", "fallback", "view" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Classes/View/FusionView.php#L291-L296
train
neos/neos-development-collection
Neos.Fusion/Migrations/Code/Version20180211184832.php
Version20180211184832.findDeclaredFusionNamespaces
protected function findDeclaredFusionNamespaces() { $namespaces = []; $targetDirectory = $this->targetPackageData['path'] . '/Resources/Private'; if(!is_dir($targetDirectory)) { return $namespaces; } foreach (Files::getRecursiveDirectoryGenerator($targetDirectory, null, true) as $pathAndFilename) { $pathInfo = pathinfo($pathAndFilename); if (!isset($pathInfo['filename'])) { continue; } if (strpos($pathAndFilename, 'Migrations/Code') !== false) { continue; } if (array_key_exists('extension', $pathInfo) && ($pathInfo['extension'] == 'ts2' || $pathInfo['extension'] == 'fusion')) { $namespaceDeclarationMatches = []; $count = preg_match_all( '/^namespace:[\\s]*(?P<alias>[\\w\\.]+)[\\s]*\\=[\\s]*(?P<packageKey>[\\w\\.]+)[\\s]*$/um', file_get_contents($pathAndFilename), $namespaceDeclarationMatches, PREG_SET_ORDER ); if ($count > 0) { foreach ($namespaceDeclarationMatches as $match) { if (!array_key_exists($match['alias'], $namespaces)) { $namespaces[$match['alias']] = $match['packageKey']; } else { if ($namespaces[$match['alias']] !== $match['packageKey']) { $this->showWarning( sprintf( 'Namespace-alias "%s" was declared multiple times for different aliases %s is used', $match['alias'], $namespaces[$match['alias']] ) ); } } } } } } return $namespaces; }
php
protected function findDeclaredFusionNamespaces() { $namespaces = []; $targetDirectory = $this->targetPackageData['path'] . '/Resources/Private'; if(!is_dir($targetDirectory)) { return $namespaces; } foreach (Files::getRecursiveDirectoryGenerator($targetDirectory, null, true) as $pathAndFilename) { $pathInfo = pathinfo($pathAndFilename); if (!isset($pathInfo['filename'])) { continue; } if (strpos($pathAndFilename, 'Migrations/Code') !== false) { continue; } if (array_key_exists('extension', $pathInfo) && ($pathInfo['extension'] == 'ts2' || $pathInfo['extension'] == 'fusion')) { $namespaceDeclarationMatches = []; $count = preg_match_all( '/^namespace:[\\s]*(?P<alias>[\\w\\.]+)[\\s]*\\=[\\s]*(?P<packageKey>[\\w\\.]+)[\\s]*$/um', file_get_contents($pathAndFilename), $namespaceDeclarationMatches, PREG_SET_ORDER ); if ($count > 0) { foreach ($namespaceDeclarationMatches as $match) { if (!array_key_exists($match['alias'], $namespaces)) { $namespaces[$match['alias']] = $match['packageKey']; } else { if ($namespaces[$match['alias']] !== $match['packageKey']) { $this->showWarning( sprintf( 'Namespace-alias "%s" was declared multiple times for different aliases %s is used', $match['alias'], $namespaces[$match['alias']] ) ); } } } } } } return $namespaces; }
[ "protected", "function", "findDeclaredFusionNamespaces", "(", ")", "{", "$", "namespaces", "=", "[", "]", ";", "$", "targetDirectory", "=", "$", "this", "->", "targetPackageData", "[", "'path'", "]", ".", "'/Resources/Private'", ";", "if", "(", "!", "is_dir", ...
Find all declared fusion namespaces for the currently migrated package @return array an array with namespace alias as key and packageKey as value @throws FilesException
[ "Find", "all", "declared", "fusion", "namespaces", "for", "the", "currently", "migrated", "package" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Fusion/Migrations/Code/Version20180211184832.php#L55-L101
train
neos/neos-development-collection
Neos.Neos/Classes/Service/VieSchemaBuilder.php
VieSchemaBuilder.generateVieSchema
public function generateVieSchema() { if ($this->configuration !== null) { return $this->configuration; } $nodeTypes = $this->nodeTypeManager->getNodeTypes(); foreach ($nodeTypes as $nodeTypeName => $nodeType) { $this->readNodeTypeConfiguration($nodeTypeName, $nodeType); } unset($this->types['typo3:unstructured']); foreach ($this->types as $nodeTypeName => $nodeTypeDefinition) { $this->types[$nodeTypeName]->subtypes = $this->getAllSubtypes($nodeTypeName); $this->types[$nodeTypeName]->ancestors = $this->getAllAncestors($nodeTypeName); $this->removeUndeclaredTypes($this->types[$nodeTypeName]->supertypes); $this->removeUndeclaredTypes($this->types[$nodeTypeName]->ancestors); } foreach ($this->properties as $property => $propertyConfiguration) { if (isset($propertyConfiguration->domains) && is_array($propertyConfiguration->domains)) { foreach ($propertyConfiguration->domains as $domain) { if (preg_match('/TYPO3\.Neos\.NodeTypes:.*Column/', $domain)) { $this->properties[$property]->ranges = array_keys($this->types); } } } } // Convert the Neos.Neos:ContentCollection element to support content-collection // TODO Move to node type definition if (isset($this->types['typo3:Neos.Neos:ContentCollection'])) { $this->addProperty('typo3:Neos.Neos:ContentCollection', 'typo3:content-collection', []); $this->types['typo3:Neos.Neos:ContentCollection']->specific_properties[] = 'typo3:content-collection'; $this->properties['typo3:content-collection']->ranges = array_keys($this->types); } $this->configuration = (object) [ 'types' => (object) $this->types, 'properties' => (object) $this->properties, ]; return $this->configuration; }
php
public function generateVieSchema() { if ($this->configuration !== null) { return $this->configuration; } $nodeTypes = $this->nodeTypeManager->getNodeTypes(); foreach ($nodeTypes as $nodeTypeName => $nodeType) { $this->readNodeTypeConfiguration($nodeTypeName, $nodeType); } unset($this->types['typo3:unstructured']); foreach ($this->types as $nodeTypeName => $nodeTypeDefinition) { $this->types[$nodeTypeName]->subtypes = $this->getAllSubtypes($nodeTypeName); $this->types[$nodeTypeName]->ancestors = $this->getAllAncestors($nodeTypeName); $this->removeUndeclaredTypes($this->types[$nodeTypeName]->supertypes); $this->removeUndeclaredTypes($this->types[$nodeTypeName]->ancestors); } foreach ($this->properties as $property => $propertyConfiguration) { if (isset($propertyConfiguration->domains) && is_array($propertyConfiguration->domains)) { foreach ($propertyConfiguration->domains as $domain) { if (preg_match('/TYPO3\.Neos\.NodeTypes:.*Column/', $domain)) { $this->properties[$property]->ranges = array_keys($this->types); } } } } // Convert the Neos.Neos:ContentCollection element to support content-collection // TODO Move to node type definition if (isset($this->types['typo3:Neos.Neos:ContentCollection'])) { $this->addProperty('typo3:Neos.Neos:ContentCollection', 'typo3:content-collection', []); $this->types['typo3:Neos.Neos:ContentCollection']->specific_properties[] = 'typo3:content-collection'; $this->properties['typo3:content-collection']->ranges = array_keys($this->types); } $this->configuration = (object) [ 'types' => (object) $this->types, 'properties' => (object) $this->properties, ]; return $this->configuration; }
[ "public", "function", "generateVieSchema", "(", ")", "{", "if", "(", "$", "this", "->", "configuration", "!==", "null", ")", "{", "return", "$", "this", "->", "configuration", ";", "}", "$", "nodeTypes", "=", "$", "this", "->", "nodeTypeManager", "->", "...
Converts the nodes types to a fully structured array in the same structure as the schema to be created. The schema also includes abstract node types for the full inheritance information in VIE. @return object
[ "Converts", "the", "nodes", "types", "to", "a", "fully", "structured", "array", "in", "the", "same", "structure", "as", "the", "schema", "to", "be", "created", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/VieSchemaBuilder.php#L62-L106
train
neos/neos-development-collection
Neos.Neos/Classes/Service/VieSchemaBuilder.php
VieSchemaBuilder.addProperty
protected function addProperty($nodeType, $propertyName, array $propertyConfiguration) { if (isset($this->properties[$propertyName])) { $this->properties[$propertyName]->domains[] = $nodeType; } else { $propertyLabel = isset($propertyConfiguration['ui']['label']) ? $propertyConfiguration['ui']['label'] : $propertyName; $this->properties[$propertyName] = (object) [ 'comment' => $propertyLabel, 'comment_plain' => $propertyLabel, 'domains' => [$nodeType], 'id' => $propertyName, 'label' => $propertyName, 'ranges' => [], 'min' => 0, 'max' => -1 ]; } }
php
protected function addProperty($nodeType, $propertyName, array $propertyConfiguration) { if (isset($this->properties[$propertyName])) { $this->properties[$propertyName]->domains[] = $nodeType; } else { $propertyLabel = isset($propertyConfiguration['ui']['label']) ? $propertyConfiguration['ui']['label'] : $propertyName; $this->properties[$propertyName] = (object) [ 'comment' => $propertyLabel, 'comment_plain' => $propertyLabel, 'domains' => [$nodeType], 'id' => $propertyName, 'label' => $propertyName, 'ranges' => [], 'min' => 0, 'max' => -1 ]; } }
[ "protected", "function", "addProperty", "(", "$", "nodeType", ",", "$", "propertyName", ",", "array", "$", "propertyConfiguration", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "properties", "[", "$", "propertyName", "]", ")", ")", "{", "$", "th...
Adds a property to the list of known properties @param string $nodeType @param string $propertyName @param array $propertyConfiguration @return void
[ "Adds", "a", "property", "to", "the", "list", "of", "known", "properties" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/VieSchemaBuilder.php#L166-L183
train
neos/neos-development-collection
Neos.Neos/Classes/Service/VieSchemaBuilder.php
VieSchemaBuilder.removeUndeclaredTypes
protected function removeUndeclaredTypes(array &$configuration) { foreach ($configuration as $index => $type) { if (!isset($this->types[$type])) { unset($configuration[$index]); } } }
php
protected function removeUndeclaredTypes(array &$configuration) { foreach ($configuration as $index => $type) { if (!isset($this->types[$type])) { unset($configuration[$index]); } } }
[ "protected", "function", "removeUndeclaredTypes", "(", "array", "&", "$", "configuration", ")", "{", "foreach", "(", "$", "configuration", "as", "$", "index", "=>", "$", "type", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "types", "[", "...
Cleans up all types which are not know in given configuration array @param array $configuration @return void
[ "Cleans", "up", "all", "types", "which", "are", "not", "know", "in", "given", "configuration", "array" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/VieSchemaBuilder.php#L191-L198
train
neos/neos-development-collection
Neos.Neos/Classes/Service/VieSchemaBuilder.php
VieSchemaBuilder.getAllAncestors
protected function getAllAncestors($type) { if (!isset($this->superTypeConfiguration[$type])) { return []; } $ancestors = $this->superTypeConfiguration[$type]; foreach ($this->superTypeConfiguration[$type] as $currentSuperType) { if (isset($this->types[$currentSuperType])) { $currentSuperTypeAncestors = $this->getAllAncestors($currentSuperType); $ancestors = array_merge($ancestors, $currentSuperTypeAncestors); } } return $ancestors; }
php
protected function getAllAncestors($type) { if (!isset($this->superTypeConfiguration[$type])) { return []; } $ancestors = $this->superTypeConfiguration[$type]; foreach ($this->superTypeConfiguration[$type] as $currentSuperType) { if (isset($this->types[$currentSuperType])) { $currentSuperTypeAncestors = $this->getAllAncestors($currentSuperType); $ancestors = array_merge($ancestors, $currentSuperTypeAncestors); } } return $ancestors; }
[ "protected", "function", "getAllAncestors", "(", "$", "type", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "superTypeConfiguration", "[", "$", "type", "]", ")", ")", "{", "return", "[", "]", ";", "}", "$", "ancestors", "=", "$", "this",...
Return all ancestors of a node type @param string $type @return array
[ "Return", "all", "ancestors", "of", "a", "node", "type" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/VieSchemaBuilder.php#L234-L249
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Backend/ContentController.php
ContentController.initializeUploadAssetAction
public function initializeUploadAssetAction() { $propertyMappingConfiguration = $this->arguments->getArgument('asset')->getPropertyMappingConfiguration(); $propertyMappingConfiguration->allowAllProperties(); $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); $propertyMappingConfiguration->setTypeConverterOption(AssetInterfaceConverter::class, AssetInterfaceConverter::CONFIGURATION_ONE_PER_RESOURCE, true); $propertyMappingConfiguration->allowCreationForSubProperty('resource'); }
php
public function initializeUploadAssetAction() { $propertyMappingConfiguration = $this->arguments->getArgument('asset')->getPropertyMappingConfiguration(); $propertyMappingConfiguration->allowAllProperties(); $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); $propertyMappingConfiguration->setTypeConverterOption(AssetInterfaceConverter::class, AssetInterfaceConverter::CONFIGURATION_ONE_PER_RESOURCE, true); $propertyMappingConfiguration->allowCreationForSubProperty('resource'); }
[ "public", "function", "initializeUploadAssetAction", "(", ")", "{", "$", "propertyMappingConfiguration", "=", "$", "this", "->", "arguments", "->", "getArgument", "(", "'asset'", ")", "->", "getPropertyMappingConfiguration", "(", ")", ";", "$", "propertyMappingConfigu...
Initialize property mapping as the upload usually comes from the Inspector JavaScript
[ "Initialize", "property", "mapping", "as", "the", "upload", "usually", "comes", "from", "the", "Inspector", "JavaScript" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Backend/ContentController.php#L109-L116
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Backend/ContentController.php
ContentController.uploadAssetAction
public function uploadAssetAction(Asset $asset, string $metadata, NodeInterface $node, string $propertyName) { $this->response->setHeader('Content-Type', 'application/json'); if ($metadata !== 'Asset' && $metadata !== 'Image') { $this->response->setStatus(400); $result = ['error' => 'Invalid "metadata" type: ' . $metadata]; } else { if ($asset instanceof ImageInterface && $metadata === 'Image') { $result = $this->getImageInterfacePreviewData($asset); } else { $result = $this->getAssetProperties($asset); } if ($this->persistenceManager->isNewObject($asset)) { $this->assetRepository->add($asset); } $this->emitAssetUploaded($asset, $node, $propertyName); } return json_encode($result); }
php
public function uploadAssetAction(Asset $asset, string $metadata, NodeInterface $node, string $propertyName) { $this->response->setHeader('Content-Type', 'application/json'); if ($metadata !== 'Asset' && $metadata !== 'Image') { $this->response->setStatus(400); $result = ['error' => 'Invalid "metadata" type: ' . $metadata]; } else { if ($asset instanceof ImageInterface && $metadata === 'Image') { $result = $this->getImageInterfacePreviewData($asset); } else { $result = $this->getAssetProperties($asset); } if ($this->persistenceManager->isNewObject($asset)) { $this->assetRepository->add($asset); } $this->emitAssetUploaded($asset, $node, $propertyName); } return json_encode($result); }
[ "public", "function", "uploadAssetAction", "(", "Asset", "$", "asset", ",", "string", "$", "metadata", ",", "NodeInterface", "$", "node", ",", "string", "$", "propertyName", ")", "{", "$", "this", "->", "response", "->", "setHeader", "(", "'Content-Type'", "...
Upload a new image, and return its metadata. Depending on the $metadata argument it will return asset metadata for the AssetEditor or image metadata for the ImageEditor Note: This action triggers the AssetUploaded signal that can be used to adjust the asset based on the (site) node it was attached to. @param Asset $asset @param string $metadata Type of metadata to return ("Asset" or "Image") @param NodeInterface $node The node the new asset should be assigned to @param string $propertyName The node property name the new asset should be assigned to @return string
[ "Upload", "a", "new", "image", "and", "return", "its", "metadata", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Backend/ContentController.php#L133-L152
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Backend/ContentController.php
ContentController.initializeCreateImageVariantAction
public function initializeCreateImageVariantAction() { $this->arguments->getArgument('asset')->getPropertyMappingConfiguration() ->allowOverrideTargetType() ->allowAllProperties() ->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); }
php
public function initializeCreateImageVariantAction() { $this->arguments->getArgument('asset')->getPropertyMappingConfiguration() ->allowOverrideTargetType() ->allowAllProperties() ->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); }
[ "public", "function", "initializeCreateImageVariantAction", "(", ")", "{", "$", "this", "->", "arguments", "->", "getArgument", "(", "'asset'", ")", "->", "getPropertyMappingConfiguration", "(", ")", "->", "allowOverrideTargetType", "(", ")", "->", "allowAllProperties...
Configure property mapping for adding a new image variant. @return void
[ "Configure", "property", "mapping", "for", "adding", "a", "new", "image", "variant", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Backend/ContentController.php#L159-L165
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Backend/ContentController.php
ContentController.createImageVariantAction
public function createImageVariantAction(ImageVariant $asset) { if ($this->persistenceManager->isNewObject($asset)) { $this->assetRepository->add($asset); } $propertyMappingConfiguration = new PropertyMappingConfiguration(); // This will not be sent as "application/json" as we need the JSON string and not the single variables. return json_encode($this->entityToIdentityConverter->convertFrom($asset, 'array', [], $propertyMappingConfiguration)); }
php
public function createImageVariantAction(ImageVariant $asset) { if ($this->persistenceManager->isNewObject($asset)) { $this->assetRepository->add($asset); } $propertyMappingConfiguration = new PropertyMappingConfiguration(); // This will not be sent as "application/json" as we need the JSON string and not the single variables. return json_encode($this->entityToIdentityConverter->convertFrom($asset, 'array', [], $propertyMappingConfiguration)); }
[ "public", "function", "createImageVariantAction", "(", "ImageVariant", "$", "asset", ")", "{", "if", "(", "$", "this", "->", "persistenceManager", "->", "isNewObject", "(", "$", "asset", ")", ")", "{", "$", "this", "->", "assetRepository", "->", "add", "(", ...
Generate a new image variant from given data. @param ImageVariant $asset @return string
[ "Generate", "a", "new", "image", "variant", "from", "given", "data", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Backend/ContentController.php#L173-L182
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Backend/ContentController.php
ContentController.imageWithMetadataAction
public function imageWithMetadataAction(ImageInterface $image) { $this->response->setHeader('Content-Type', 'application/json'); $imageProperties = $this->getImageInterfacePreviewData($image); return json_encode($imageProperties); }
php
public function imageWithMetadataAction(ImageInterface $image) { $this->response->setHeader('Content-Type', 'application/json'); $imageProperties = $this->getImageInterfacePreviewData($image); return json_encode($imageProperties); }
[ "public", "function", "imageWithMetadataAction", "(", "ImageInterface", "$", "image", ")", "{", "$", "this", "->", "response", "->", "setHeader", "(", "'Content-Type'", ",", "'application/json'", ")", ";", "$", "imageProperties", "=", "$", "this", "->", "getImag...
Fetch the metadata for a given image @param ImageInterface $image @return string JSON encoded response
[ "Fetch", "the", "metadata", "for", "a", "given", "image" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Backend/ContentController.php#L191-L197
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Backend/ContentController.php
ContentController.getImageInterfacePreviewData
protected function getImageInterfacePreviewData(ImageInterface $image) { // TODO: Now that we try to support all ImageInterface implementations we should use a strategy here to get the image properties for custom implementations if ($image instanceof ImageVariant) { $imageProperties = $this->getImageVariantPreviewData($image); } else { $imageProperties = $this->getImagePreviewData($image); } $imageProperties['object'] = $this->imageInterfaceArrayPresenter->convertFrom($image, 'string'); return $imageProperties; }
php
protected function getImageInterfacePreviewData(ImageInterface $image) { // TODO: Now that we try to support all ImageInterface implementations we should use a strategy here to get the image properties for custom implementations if ($image instanceof ImageVariant) { $imageProperties = $this->getImageVariantPreviewData($image); } else { $imageProperties = $this->getImagePreviewData($image); } $imageProperties['object'] = $this->imageInterfaceArrayPresenter->convertFrom($image, 'string'); return $imageProperties; }
[ "protected", "function", "getImageInterfacePreviewData", "(", "ImageInterface", "$", "image", ")", "{", "// TODO: Now that we try to support all ImageInterface implementations we should use a strategy here to get the image properties for custom implementations", "if", "(", "$", "image", ...
Returns important meta data for the given object implementing ImageInterface. Will return an array with the following keys: "originalImageResourceUri": Uri for the original resource "previewImageResourceUri": Uri for a preview image with reduced size "originalDimensions": Dimensions for the original image (width, height, aspectRatio) "previewDimensions": Dimensions for the preview image (width, height) "object": object properties like the __identity and __type of the object @param ImageInterface $image The image to retrieve meta data for @return array
[ "Returns", "important", "meta", "data", "for", "the", "given", "object", "implementing", "ImageInterface", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Backend/ContentController.php#L213-L224
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Backend/ContentController.php
ContentController.assetsWithMetadataAction
public function assetsWithMetadataAction(array $assets) { $this->response->setHeader('Content-Type', 'application/json'); $result = []; foreach ($assets as $asset) { $result[] = $this->getAssetProperties($asset); } return json_encode($result); }
php
public function assetsWithMetadataAction(array $assets) { $this->response->setHeader('Content-Type', 'application/json'); $result = []; foreach ($assets as $asset) { $result[] = $this->getAssetProperties($asset); } return json_encode($result); }
[ "public", "function", "assetsWithMetadataAction", "(", "array", "$", "assets", ")", "{", "$", "this", "->", "response", "->", "setHeader", "(", "'Content-Type'", ",", "'application/json'", ")", ";", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "...
Fetch the metadata for multiple assets @param array<Neos\Media\Domain\Model\AssetInterface> $assets @return string JSON encoded response
[ "Fetch", "the", "metadata", "for", "multiple", "assets" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Backend/ContentController.php#L280-L289
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Backend/ContentController.php
ContentController.pluginViewsAction
public function pluginViewsAction($identifier = null, $workspaceName = 'live', array $dimensions = []) { $this->response->setHeader('Content-Type', 'application/json'); $contentContext = $this->createContentContext($workspaceName, $dimensions); /** @var $node NodeInterface */ $node = $contentContext->getNodeByIdentifier($identifier); $views = []; if ($node !== null) { /** @var $pluginViewDefinition PluginViewDefinition */ $pluginViewDefinitions = $this->pluginService->getPluginViewDefinitionsByPluginNodeType($node->getNodeType()); foreach ($pluginViewDefinitions as $pluginViewDefinition) { $label = $pluginViewDefinition->getLabel(); $views[$pluginViewDefinition->getName()] = ['label' => $label]; $pluginViewNode = $this->pluginService->getPluginViewNodeByMasterPlugin($node, $pluginViewDefinition->getName()); if ($pluginViewNode === null) { continue; } $q = new FlowQuery([$pluginViewNode]); $page = $q->closest('[instanceof Neos.Neos:Document]')->get(0); $uri = $this->uriBuilder ->reset() ->uriFor('show', ['node' => $page], 'Frontend\Node', 'Neos.Neos'); $views[$pluginViewDefinition->getName()] = [ 'label' => $label, 'pageNode' => [ 'title' => $page->getLabel(), 'uri' => $uri ] ]; } } return json_encode((object) $views); }
php
public function pluginViewsAction($identifier = null, $workspaceName = 'live', array $dimensions = []) { $this->response->setHeader('Content-Type', 'application/json'); $contentContext = $this->createContentContext($workspaceName, $dimensions); /** @var $node NodeInterface */ $node = $contentContext->getNodeByIdentifier($identifier); $views = []; if ($node !== null) { /** @var $pluginViewDefinition PluginViewDefinition */ $pluginViewDefinitions = $this->pluginService->getPluginViewDefinitionsByPluginNodeType($node->getNodeType()); foreach ($pluginViewDefinitions as $pluginViewDefinition) { $label = $pluginViewDefinition->getLabel(); $views[$pluginViewDefinition->getName()] = ['label' => $label]; $pluginViewNode = $this->pluginService->getPluginViewNodeByMasterPlugin($node, $pluginViewDefinition->getName()); if ($pluginViewNode === null) { continue; } $q = new FlowQuery([$pluginViewNode]); $page = $q->closest('[instanceof Neos.Neos:Document]')->get(0); $uri = $this->uriBuilder ->reset() ->uriFor('show', ['node' => $page], 'Frontend\Node', 'Neos.Neos'); $views[$pluginViewDefinition->getName()] = [ 'label' => $label, 'pageNode' => [ 'title' => $page->getLabel(), 'uri' => $uri ] ]; } } return json_encode((object) $views); }
[ "public", "function", "pluginViewsAction", "(", "$", "identifier", "=", "null", ",", "$", "workspaceName", "=", "'live'", ",", "array", "$", "dimensions", "=", "[", "]", ")", "{", "$", "this", "->", "response", "->", "setHeader", "(", "'Content-Type'", ","...
Fetch the configured views for the given master plugin @param string $identifier Specifies the node to look up @param string $workspaceName Name of the workspace to use for querying the node @param array $dimensions Optional list of dimensions and their values which should be used for querying the specified node @return string
[ "Fetch", "the", "configured", "views", "for", "the", "given", "master", "plugin" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Backend/ContentController.php#L318-L354
train
neos/neos-development-collection
Neos.Neos/Classes/Controller/Backend/ContentController.php
ContentController.masterPluginsAction
public function masterPluginsAction($workspaceName = 'live', array $dimensions = []) { $this->response->setHeader('Content-Type', 'application/json'); $contentContext = $this->createContentContext($workspaceName, $dimensions); $pluginNodes = $this->pluginService->getPluginNodesWithViewDefinitions($contentContext); $masterPlugins = []; if (is_array($pluginNodes)) { /** @var $pluginNode NodeInterface */ foreach ($pluginNodes as $pluginNode) { if ($pluginNode->isRemoved()) { continue; } $q = new FlowQuery([$pluginNode]); $page = $q->closest('[instanceof Neos.Neos:Document]')->get(0); if ($page === null) { continue; } $translationHelper = new TranslationHelper(); $masterPlugins[$pluginNode->getIdentifier()] = $translationHelper->translate( 'masterPlugins.nodeTypeOnPageLabel', null, ['nodeTypeName' => $translationHelper->translate($pluginNode->getNodeType()->getLabel()), 'pageLabel' => $page->getLabel()], 'Main', 'Neos.Neos' ); } } return json_encode((object) $masterPlugins); }
php
public function masterPluginsAction($workspaceName = 'live', array $dimensions = []) { $this->response->setHeader('Content-Type', 'application/json'); $contentContext = $this->createContentContext($workspaceName, $dimensions); $pluginNodes = $this->pluginService->getPluginNodesWithViewDefinitions($contentContext); $masterPlugins = []; if (is_array($pluginNodes)) { /** @var $pluginNode NodeInterface */ foreach ($pluginNodes as $pluginNode) { if ($pluginNode->isRemoved()) { continue; } $q = new FlowQuery([$pluginNode]); $page = $q->closest('[instanceof Neos.Neos:Document]')->get(0); if ($page === null) { continue; } $translationHelper = new TranslationHelper(); $masterPlugins[$pluginNode->getIdentifier()] = $translationHelper->translate( 'masterPlugins.nodeTypeOnPageLabel', null, ['nodeTypeName' => $translationHelper->translate($pluginNode->getNodeType()->getLabel()), 'pageLabel' => $page->getLabel()], 'Main', 'Neos.Neos' ); } } return json_encode((object) $masterPlugins); }
[ "public", "function", "masterPluginsAction", "(", "$", "workspaceName", "=", "'live'", ",", "array", "$", "dimensions", "=", "[", "]", ")", "{", "$", "this", "->", "response", "->", "setHeader", "(", "'Content-Type'", ",", "'application/json'", ")", ";", "$"...
Fetch all master plugins that are available in the current workspace. @param string $workspaceName Name of the workspace to use for querying the node @param array $dimensions Optional list of dimensions and their values which should be used for querying the specified node @return string JSON encoded array of node path => label
[ "Fetch", "all", "master", "plugins", "that", "are", "available", "in", "the", "current", "workspace", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Controller/Backend/ContentController.php#L364-L394
train
neos/neos-development-collection
Neos.Neos/Classes/Service/View/NodeView.php
NodeView.assignNode
public function assignNode(NodeInterface $node, array $propertyNames = ['name', 'path', 'identifier', 'properties', 'nodeType']) { $this->setConfiguration( [ 'value' => [ 'data' => [ '_only' => ['name', 'path', 'identifier', 'properties', 'nodeType'], '_descend' => ['properties' => $propertyNames] ] ] ] ); $this->assign('value', ['data' => $node, 'success' => true]); }
php
public function assignNode(NodeInterface $node, array $propertyNames = ['name', 'path', 'identifier', 'properties', 'nodeType']) { $this->setConfiguration( [ 'value' => [ 'data' => [ '_only' => ['name', 'path', 'identifier', 'properties', 'nodeType'], '_descend' => ['properties' => $propertyNames] ] ] ] ); $this->assign('value', ['data' => $node, 'success' => true]); }
[ "public", "function", "assignNode", "(", "NodeInterface", "$", "node", ",", "array", "$", "propertyNames", "=", "[", "'name'", ",", "'path'", ",", "'identifier'", ",", "'properties'", ",", "'nodeType'", "]", ")", "{", "$", "this", "->", "setConfiguration", "...
Assigns a node to the NodeView. @param NodeInterface $node The node to render @param array $propertyNames Optional list of property names to include in the JSON output @return void
[ "Assigns", "a", "node", "to", "the", "NodeView", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/View/NodeView.php#L65-L78
train
neos/neos-development-collection
Neos.Neos/Classes/Service/View/NodeView.php
NodeView.assignChildNodes
public function assignChildNodes(NodeInterface $node, $nodeTypeFilter, $outputStyle = self::STYLE_LIST, $depth = 0, NodeInterface $untilNode = null) { $this->outputStyle = $outputStyle; $nodes = []; if ($this->privilegeManager->isGranted(NodeTreePrivilege::class, new NodePrivilegeSubject($node))) { $this->collectChildNodeData($nodes, $node, ($nodeTypeFilter === '' ? null : $nodeTypeFilter), $depth, $untilNode); } $this->setConfiguration(['value' => ['data' => ['_descendAll' => []]]]); $this->assign('value', ['data' => $nodes, 'success' => true]); }
php
public function assignChildNodes(NodeInterface $node, $nodeTypeFilter, $outputStyle = self::STYLE_LIST, $depth = 0, NodeInterface $untilNode = null) { $this->outputStyle = $outputStyle; $nodes = []; if ($this->privilegeManager->isGranted(NodeTreePrivilege::class, new NodePrivilegeSubject($node))) { $this->collectChildNodeData($nodes, $node, ($nodeTypeFilter === '' ? null : $nodeTypeFilter), $depth, $untilNode); } $this->setConfiguration(['value' => ['data' => ['_descendAll' => []]]]); $this->assign('value', ['data' => $nodes, 'success' => true]); }
[ "public", "function", "assignChildNodes", "(", "NodeInterface", "$", "node", ",", "$", "nodeTypeFilter", ",", "$", "outputStyle", "=", "self", "::", "STYLE_LIST", ",", "$", "depth", "=", "0", ",", "NodeInterface", "$", "untilNode", "=", "null", ")", "{", "...
Prepares this view to render a list or tree of child nodes of the given node. @param NodeInterface $node The node to fetch child nodes of @param string $nodeTypeFilter Criteria for filtering the child nodes @param integer $outputStyle Either STYLE_TREE or STYLE_list @param integer $depth How many levels of childNodes (0 = unlimited) @param NodeInterface $untilNode if given, expand all nodes on the rootline towards $untilNode, no matter what is defined with $depth. @return void
[ "Prepares", "this", "view", "to", "render", "a", "list", "or", "tree", "of", "child", "nodes", "of", "the", "given", "node", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/View/NodeView.php#L115-L125
train
neos/neos-development-collection
Neos.Neos/Classes/Service/View/NodeView.php
NodeView.assignNodeAndChildNodes
public function assignNodeAndChildNodes(NodeInterface $node, $nodeTypeFilter = '', $depth = 0, NodeInterface $untilNode = null) { $this->outputStyle = self::STYLE_TREE; $data = []; if ($this->privilegeManager->isGranted(NodeTreePrivilege::class, new NodePrivilegeSubject($node))) { $childNodes = []; $this->collectChildNodeData($childNodes, $node, ($nodeTypeFilter === '' ? null : $nodeTypeFilter), $depth, $untilNode); $data = $this->collectTreeNodeData($node, true, $childNodes, $childNodes !== []); } $this->setConfiguration(['value' => ['data' => ['_descendAll' => []]]]); $this->assign('value', ['data' => $data, 'success' => true]); }
php
public function assignNodeAndChildNodes(NodeInterface $node, $nodeTypeFilter = '', $depth = 0, NodeInterface $untilNode = null) { $this->outputStyle = self::STYLE_TREE; $data = []; if ($this->privilegeManager->isGranted(NodeTreePrivilege::class, new NodePrivilegeSubject($node))) { $childNodes = []; $this->collectChildNodeData($childNodes, $node, ($nodeTypeFilter === '' ? null : $nodeTypeFilter), $depth, $untilNode); $data = $this->collectTreeNodeData($node, true, $childNodes, $childNodes !== []); } $this->setConfiguration(['value' => ['data' => ['_descendAll' => []]]]); $this->assign('value', ['data' => $data, 'success' => true]); }
[ "public", "function", "assignNodeAndChildNodes", "(", "NodeInterface", "$", "node", ",", "$", "nodeTypeFilter", "=", "''", ",", "$", "depth", "=", "0", ",", "NodeInterface", "$", "untilNode", "=", "null", ")", "{", "$", "this", "->", "outputStyle", "=", "s...
Prepares this view to render a list or tree of given node including child nodes. @param NodeInterface $node The node to fetch child nodes of @param string $nodeTypeFilter Criteria for filtering the child nodes @param integer $depth How many levels of childNodes (0 = unlimited) @param NodeInterface $untilNode if given, expand all nodes on the rootline towards $untilNode, no matter what is defined with $depth. @return void
[ "Prepares", "this", "view", "to", "render", "a", "list", "or", "tree", "of", "given", "node", "including", "child", "nodes", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/View/NodeView.php#L136-L148
train
neos/neos-development-collection
Neos.Neos/Classes/Service/View/NodeView.php
NodeView.assignFilteredChildNodes
public function assignFilteredChildNodes(NodeInterface $node, array $matchedNodes, $outputStyle = self::STYLE_LIST) { $this->outputStyle = $outputStyle; $nodes = $this->collectParentNodeData($node, $matchedNodes); $this->setConfiguration(['value' => ['data' => ['_descendAll' => []]]]); $this->assign('value', ['data' => $nodes, 'success' => true]); }
php
public function assignFilteredChildNodes(NodeInterface $node, array $matchedNodes, $outputStyle = self::STYLE_LIST) { $this->outputStyle = $outputStyle; $nodes = $this->collectParentNodeData($node, $matchedNodes); $this->setConfiguration(['value' => ['data' => ['_descendAll' => []]]]); $this->assign('value', ['data' => $nodes, 'success' => true]); }
[ "public", "function", "assignFilteredChildNodes", "(", "NodeInterface", "$", "node", ",", "array", "$", "matchedNodes", ",", "$", "outputStyle", "=", "self", "::", "STYLE_LIST", ")", "{", "$", "this", "->", "outputStyle", "=", "$", "outputStyle", ";", "$", "...
Prepares this view to render a list or tree of filtered nodes. @param NodeInterface $node @param array<\Neos\ContentRepository\Domain\Model\NodeData> $matchedNodes @param integer $outputStyle Either STYLE_TREE or STYLE_list @return void
[ "Prepares", "this", "view", "to", "render", "a", "list", "or", "tree", "of", "filtered", "nodes", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/View/NodeView.php#L158-L165
train
neos/neos-development-collection
Neos.Neos/Classes/Service/View/NodeView.php
NodeView.collectChildNodeData
protected function collectChildNodeData(array &$nodes, NodeInterface $node, $nodeTypeFilter, $depth = 0, NodeInterface $untilNode = null, $recursionPointer = 1) { foreach ($node->getChildNodes($nodeTypeFilter) as $childNode) { if (!$this->privilegeManager->isGranted(NodeTreePrivilege::class, new NodePrivilegeSubject($childNode))) { continue; } /** @var NodeInterface $childNode */ $expand = ($depth === 0 || $recursionPointer < $depth); if ($expand === false && $untilNode !== null && strpos($untilNode->getPath(), $childNode->getPath()) === 0 && $childNode !== $untilNode) { // in case $untilNode is set, and the current childNode is on the rootline of $untilNode (and not the node itself), expand the node. $expand = true; } switch ($this->outputStyle) { case self::STYLE_LIST: $nodeType = $childNode->getNodeType()->getName(); $properties = $childNode->getProperties(); $properties['__contextNodePath'] = $childNode->getContextPath(); $properties['__workspaceName'] = $childNode->getWorkspace()->getName(); $properties['__nodeName'] = $childNode->getName(); $properties['__nodeType'] = $nodeType; $properties['__title'] = $nodeType === 'Neos.Neos:Document' ? $childNode->getProperty('title') : $childNode->getLabel(); array_push($nodes, $properties); if ($expand) { $this->collectChildNodeData($nodes, $childNode, $nodeTypeFilter, $depth, $untilNode, ($recursionPointer + 1)); } break; case self::STYLE_TREE: $children = []; $hasChildNodes = $childNode->hasChildNodes($nodeTypeFilter) === true; if ($expand && $hasChildNodes) { $this->collectChildNodeData($children, $childNode, $nodeTypeFilter, $depth, $untilNode, ($recursionPointer + 1)); } array_push($nodes, $this->collectTreeNodeData($childNode, $expand, $children, $hasChildNodes)); } } }
php
protected function collectChildNodeData(array &$nodes, NodeInterface $node, $nodeTypeFilter, $depth = 0, NodeInterface $untilNode = null, $recursionPointer = 1) { foreach ($node->getChildNodes($nodeTypeFilter) as $childNode) { if (!$this->privilegeManager->isGranted(NodeTreePrivilege::class, new NodePrivilegeSubject($childNode))) { continue; } /** @var NodeInterface $childNode */ $expand = ($depth === 0 || $recursionPointer < $depth); if ($expand === false && $untilNode !== null && strpos($untilNode->getPath(), $childNode->getPath()) === 0 && $childNode !== $untilNode) { // in case $untilNode is set, and the current childNode is on the rootline of $untilNode (and not the node itself), expand the node. $expand = true; } switch ($this->outputStyle) { case self::STYLE_LIST: $nodeType = $childNode->getNodeType()->getName(); $properties = $childNode->getProperties(); $properties['__contextNodePath'] = $childNode->getContextPath(); $properties['__workspaceName'] = $childNode->getWorkspace()->getName(); $properties['__nodeName'] = $childNode->getName(); $properties['__nodeType'] = $nodeType; $properties['__title'] = $nodeType === 'Neos.Neos:Document' ? $childNode->getProperty('title') : $childNode->getLabel(); array_push($nodes, $properties); if ($expand) { $this->collectChildNodeData($nodes, $childNode, $nodeTypeFilter, $depth, $untilNode, ($recursionPointer + 1)); } break; case self::STYLE_TREE: $children = []; $hasChildNodes = $childNode->hasChildNodes($nodeTypeFilter) === true; if ($expand && $hasChildNodes) { $this->collectChildNodeData($children, $childNode, $nodeTypeFilter, $depth, $untilNode, ($recursionPointer + 1)); } array_push($nodes, $this->collectTreeNodeData($childNode, $expand, $children, $hasChildNodes)); } } }
[ "protected", "function", "collectChildNodeData", "(", "array", "&", "$", "nodes", ",", "NodeInterface", "$", "node", ",", "$", "nodeTypeFilter", ",", "$", "depth", "=", "0", ",", "NodeInterface", "$", "untilNode", "=", "null", ",", "$", "recursionPointer", "...
Collect node data and traverse child nodes @param array &$nodes @param NodeInterface $node @param string $nodeTypeFilter @param integer $depth levels of child nodes to fetch. 0 = unlimited @param \Neos\ContentRepository\Domain\Model\NodeInterface $untilNode if given, expand all nodes on the rootline towards $untilNode, no matter what is defined with $depth. @param integer $recursionPointer current recursion level @return void
[ "Collect", "node", "data", "and", "traverse", "child", "nodes" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/View/NodeView.php#L178-L215
train
neos/neos-development-collection
Neos.Neos/Classes/Service/UserService.php
UserService.getPersonalWorkspace
public function getPersonalWorkspace() { $workspaceName = $this->getPersonalWorkspaceName(); if ($workspaceName !== null) { return $this->workspaceRepository->findOneByName($this->getPersonalWorkspaceName()); } }
php
public function getPersonalWorkspace() { $workspaceName = $this->getPersonalWorkspaceName(); if ($workspaceName !== null) { return $this->workspaceRepository->findOneByName($this->getPersonalWorkspaceName()); } }
[ "public", "function", "getPersonalWorkspace", "(", ")", "{", "$", "workspaceName", "=", "$", "this", "->", "getPersonalWorkspaceName", "(", ")", ";", "if", "(", "$", "workspaceName", "!==", "null", ")", "{", "return", "$", "this", "->", "workspaceRepository", ...
Returns the current user's personal workspace or null if no user is logged in @return Workspace @api
[ "Returns", "the", "current", "user", "s", "personal", "workspace", "or", "null", "if", "no", "user", "is", "logged", "in" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/UserService.php#L69-L75
train
neos/neos-development-collection
Neos.Neos/Classes/Service/UserService.php
UserService.getUserPreference
public function getUserPreference($preference) { $user = $this->getBackendUser(); if ($user && $user->getPreferences()) { return $user->getPreferences()->get($preference) ?: null; } }
php
public function getUserPreference($preference) { $user = $this->getBackendUser(); if ($user && $user->getPreferences()) { return $user->getPreferences()->get($preference) ?: null; } }
[ "public", "function", "getUserPreference", "(", "$", "preference", ")", "{", "$", "user", "=", "$", "this", "->", "getBackendUser", "(", ")", ";", "if", "(", "$", "user", "&&", "$", "user", "->", "getPreferences", "(", ")", ")", "{", "return", "$", "...
Returns the stored preferences of a user @param string $preference @return mixed @api
[ "Returns", "the", "stored", "preferences", "of", "a", "user" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Service/UserService.php#L103-L109
train
neos/neos-development-collection
Neos.ContentRepository/Classes/Migration/Transformations/AddDimensions.php
AddDimensions.execute
public function execute(NodeData $node) { $dimensionValuesToBeAdded = $node->getDimensionValues(); foreach ($this->dimensionValues as $dimensionName => $dimensionValues) { if (!isset($dimensionValuesToBeAdded[$dimensionName])) { if (is_array($dimensionValues)) { $dimensionValuesToBeAdded[$dimensionName] = $dimensionValues; } else { $dimensionValuesToBeAdded[$dimensionName] = [$dimensionValues]; } } } if ($this->addDefaultDimensionValues === true) { $configuredDimensions = $this->contentDimensionRepository->findAll(); foreach ($configuredDimensions as $configuredDimension) { if (!isset($dimensionValuesToBeAdded[$configuredDimension->getIdentifier()])) { $dimensionValuesToBeAdded[$configuredDimension->getIdentifier()] = [$configuredDimension->getDefault()]; } } } $dimensionsToBeSet = []; foreach ($dimensionValuesToBeAdded as $dimensionName => $dimensionValues) { foreach ($dimensionValues as $dimensionValue) { $dimensionsToBeSet[] = new NodeDimension($node, $dimensionName, $dimensionValue); } } $node->setDimensions($dimensionsToBeSet); }
php
public function execute(NodeData $node) { $dimensionValuesToBeAdded = $node->getDimensionValues(); foreach ($this->dimensionValues as $dimensionName => $dimensionValues) { if (!isset($dimensionValuesToBeAdded[$dimensionName])) { if (is_array($dimensionValues)) { $dimensionValuesToBeAdded[$dimensionName] = $dimensionValues; } else { $dimensionValuesToBeAdded[$dimensionName] = [$dimensionValues]; } } } if ($this->addDefaultDimensionValues === true) { $configuredDimensions = $this->contentDimensionRepository->findAll(); foreach ($configuredDimensions as $configuredDimension) { if (!isset($dimensionValuesToBeAdded[$configuredDimension->getIdentifier()])) { $dimensionValuesToBeAdded[$configuredDimension->getIdentifier()] = [$configuredDimension->getDefault()]; } } } $dimensionsToBeSet = []; foreach ($dimensionValuesToBeAdded as $dimensionName => $dimensionValues) { foreach ($dimensionValues as $dimensionValue) { $dimensionsToBeSet[] = new NodeDimension($node, $dimensionName, $dimensionValue); } } $node->setDimensions($dimensionsToBeSet); }
[ "public", "function", "execute", "(", "NodeData", "$", "node", ")", "{", "$", "dimensionValuesToBeAdded", "=", "$", "node", "->", "getDimensionValues", "(", ")", ";", "foreach", "(", "$", "this", "->", "dimensionValues", "as", "$", "dimensionName", "=>", "$"...
Add dimensions to the node. @param NodeData $node @return void
[ "Add", "dimensions", "to", "the", "node", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.ContentRepository/Classes/Migration/Transformations/AddDimensions.php#L67-L98
train
neos/neos-development-collection
Neos.Neos/Classes/Domain/Service/ContentContextFactory.php
ContentContextFactory.setDefaultSiteAndDomainFromCurrentRequest
protected function setDefaultSiteAndDomainFromCurrentRequest(array $defaultContextProperties) { $currentDomain = $this->domainRepository->findOneByActiveRequest(); if ($currentDomain !== null) { $defaultContextProperties['currentSite'] = $currentDomain->getSite(); $defaultContextProperties['currentDomain'] = $currentDomain; } else { $defaultContextProperties['currentSite'] = $this->siteRepository->findDefault(); } return $defaultContextProperties; }
php
protected function setDefaultSiteAndDomainFromCurrentRequest(array $defaultContextProperties) { $currentDomain = $this->domainRepository->findOneByActiveRequest(); if ($currentDomain !== null) { $defaultContextProperties['currentSite'] = $currentDomain->getSite(); $defaultContextProperties['currentDomain'] = $currentDomain; } else { $defaultContextProperties['currentSite'] = $this->siteRepository->findDefault(); } return $defaultContextProperties; }
[ "protected", "function", "setDefaultSiteAndDomainFromCurrentRequest", "(", "array", "$", "defaultContextProperties", ")", "{", "$", "currentDomain", "=", "$", "this", "->", "domainRepository", "->", "findOneByActiveRequest", "(", ")", ";", "if", "(", "$", "currentDoma...
Determines the current domain and site from the request and sets the resulting values as as defaults. @param array $defaultContextProperties @return array
[ "Determines", "the", "current", "domain", "and", "site", "from", "the", "request", "and", "sets", "the", "resulting", "values", "as", "as", "defaults", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Neos/Classes/Domain/Service/ContentContextFactory.php#L116-L127
train
neos/neos-development-collection
Neos.Media/Classes/Domain/Model/DimensionsTrait.php
DimensionsTrait.getOrientation
public function getOrientation() { $aspectRatio = $this->getAspectRatio(true); if ($aspectRatio > 1) { return ImageInterface::ORIENTATION_LANDSCAPE; } elseif ($aspectRatio < 1) { return ImageInterface::ORIENTATION_PORTRAIT; } else { return ImageInterface::ORIENTATION_SQUARE; } }
php
public function getOrientation() { $aspectRatio = $this->getAspectRatio(true); if ($aspectRatio > 1) { return ImageInterface::ORIENTATION_LANDSCAPE; } elseif ($aspectRatio < 1) { return ImageInterface::ORIENTATION_PORTRAIT; } else { return ImageInterface::ORIENTATION_SQUARE; } }
[ "public", "function", "getOrientation", "(", ")", "{", "$", "aspectRatio", "=", "$", "this", "->", "getAspectRatio", "(", "true", ")", ";", "if", "(", "$", "aspectRatio", ">", "1", ")", "{", "return", "ImageInterface", "::", "ORIENTATION_LANDSCAPE", ";", "...
Orientation of this image, i.e. portrait, landscape or square @return string One of this interface's ORIENTATION_* constants.
[ "Orientation", "of", "this", "image", "i", ".", "e", ".", "portrait", "landscape", "or", "square" ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.Media/Classes/Domain/Model/DimensionsTrait.php#L88-L98
train
neos/neos-development-collection
Neos.SiteKickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateSitePackage
public function generateSitePackage($packageKey, $siteName) { $this->packageManager->createPackage($packageKey, [ 'type' => 'neos-site', "require" => [ "neos/neos" => "*", "neos/nodetypes" => "*" ], "suggest" => [ "neos/seo" => "*" ] ]); $this->generateSitesXml($packageKey, $siteName); $this->generateSitesRootFusion($packageKey, $siteName); $this->generateSitesPageFusion($packageKey, $siteName); $this->generateDefaultTemplate($packageKey, $siteName); $this->generateNodeTypesConfiguration($packageKey); $this->generateAdditionalFolders($packageKey); return $this->generatedFiles; }
php
public function generateSitePackage($packageKey, $siteName) { $this->packageManager->createPackage($packageKey, [ 'type' => 'neos-site', "require" => [ "neos/neos" => "*", "neos/nodetypes" => "*" ], "suggest" => [ "neos/seo" => "*" ] ]); $this->generateSitesXml($packageKey, $siteName); $this->generateSitesRootFusion($packageKey, $siteName); $this->generateSitesPageFusion($packageKey, $siteName); $this->generateDefaultTemplate($packageKey, $siteName); $this->generateNodeTypesConfiguration($packageKey); $this->generateAdditionalFolders($packageKey); return $this->generatedFiles; }
[ "public", "function", "generateSitePackage", "(", "$", "packageKey", ",", "$", "siteName", ")", "{", "$", "this", "->", "packageManager", "->", "createPackage", "(", "$", "packageKey", ",", "[", "'type'", "=>", "'neos-site'", ",", "\"require\"", "=>", "[", "...
Generate a site package and fill it with boilerplate data. @param string $packageKey @param string $siteName @return array
[ "Generate", "a", "site", "package", "and", "fill", "it", "with", "boilerplate", "data", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.SiteKickstarter/Classes/Service/GeneratorService.php#L44-L65
train
neos/neos-development-collection
Neos.SiteKickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateSitesXml
protected function generateSitesXml($packageKey, $siteName) { $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Content/Sites.xml'; $contextVariables = [ 'packageKey' => $packageKey, 'siteName' => htmlspecialchars($siteName), 'siteNodeName' => $this->generateSiteNodeName($packageKey), 'dimensions' => $this->contentDimensionRepository->findAll() ]; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $sitesXmlPathAndFilename = $this->packageManager->getPackage($packageKey)->getResourcesPath() . 'Private/Content/Sites.xml'; $this->generateFile($sitesXmlPathAndFilename, $fileContent); }
php
protected function generateSitesXml($packageKey, $siteName) { $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Content/Sites.xml'; $contextVariables = [ 'packageKey' => $packageKey, 'siteName' => htmlspecialchars($siteName), 'siteNodeName' => $this->generateSiteNodeName($packageKey), 'dimensions' => $this->contentDimensionRepository->findAll() ]; $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables); $sitesXmlPathAndFilename = $this->packageManager->getPackage($packageKey)->getResourcesPath() . 'Private/Content/Sites.xml'; $this->generateFile($sitesXmlPathAndFilename, $fileContent); }
[ "protected", "function", "generateSitesXml", "(", "$", "packageKey", ",", "$", "siteName", ")", "{", "$", "templatePathAndFilename", "=", "'resource://Neos.SiteKickstarter/Private/Generator/Content/Sites.xml'", ";", "$", "contextVariables", "=", "[", "'packageKey'", "=>", ...
Generate a "Sites.xml" for the given package and name. @param string $packageKey @param string $siteName @return void
[ "Generate", "a", "Sites", ".", "xml", "for", "the", "given", "package", "and", "name", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.SiteKickstarter/Classes/Service/GeneratorService.php#L74-L89
train
neos/neos-development-collection
Neos.SiteKickstarter/Classes/Service/GeneratorService.php
GeneratorService.generateSitesRootFusion
protected function generateSitesRootFusion($packageKey, $siteName) { $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Fusion/Root.fusion'; $contextVariables = [ 'packageKey' => $packageKey, 'siteName' => $siteName, 'siteNodeName' => $this->generateSiteNodeName($packageKey) ]; $fileContent = $this->renderSimpleTemplate($templatePathAndFilename, $contextVariables); $sitesRootFusionPathAndFilename = $this->packageManager->getPackage($packageKey)->getResourcesPath() . 'Private/Fusion/Root.fusion'; $this->generateFile($sitesRootFusionPathAndFilename, $fileContent); }
php
protected function generateSitesRootFusion($packageKey, $siteName) { $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Fusion/Root.fusion'; $contextVariables = [ 'packageKey' => $packageKey, 'siteName' => $siteName, 'siteNodeName' => $this->generateSiteNodeName($packageKey) ]; $fileContent = $this->renderSimpleTemplate($templatePathAndFilename, $contextVariables); $sitesRootFusionPathAndFilename = $this->packageManager->getPackage($packageKey)->getResourcesPath() . 'Private/Fusion/Root.fusion'; $this->generateFile($sitesRootFusionPathAndFilename, $fileContent); }
[ "protected", "function", "generateSitesRootFusion", "(", "$", "packageKey", ",", "$", "siteName", ")", "{", "$", "templatePathAndFilename", "=", "'resource://Neos.SiteKickstarter/Private/Generator/Fusion/Root.fusion'", ";", "$", "contextVariables", "=", "[", "'packageKey'", ...
Generate basic root Fusion file. @param string $packageKey @param string $siteName @return void
[ "Generate", "basic", "root", "Fusion", "file", "." ]
9062fb5e8e9217bc99324b7eba0378e9274fc051
https://github.com/neos/neos-development-collection/blob/9062fb5e8e9217bc99324b7eba0378e9274fc051/Neos.SiteKickstarter/Classes/Service/GeneratorService.php#L98-L112
train