{"action":"created","comment":{"url":"https://api.github.com/repos/neos/neos-development-collection/pulls/comments/64042111","id":64042111,"diff_hunk":"@@ -0,0 +1,216 @@\n+<?php\n+namespace TYPO3\\Neos\\TypoScript;\n+\n+use TYPO3\\Eel\\FlowQuery\\FlowQuery;\n+use TYPO3\\Eel\\Utility;\n+use TYPO3\\Flow\\Annotations as Flow;\n+use TYPO3\\Neos\\Domain\\Service\\ConfigurationContentDimensionPresetSource;\n+use TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface;\n+use TYPO3\\TYPO3CR\\Domain\\Service\\ContentDimensionCombinator;\n+use TYPO3\\TypoScript\\Exception as TypoScriptException;\n+\n+/**\n+ * TypoScript implementation for a dimensions menu.\n+ *\n+ * The items generated by this menu will be all possible variants (according to the configured dimensions\n+ * and presets) of the given node (including the given node).\n+ *\n+ * If a 'dimension' is configured via TypoScript, only the possible variants for that dimension will\n+ * be included in the menu, any other dimensions will be kept from the current context.\n+ *\n+ * Main Options:\n+ * - dimension (optional, string): name of the dimension which this menu should be limited to. Example: \"language\".\n+ * - presets (optional, array): If set, the presets are not loaded from the Settings, but instead taken from this property. Must be used with \"dimension\" set.\n+ * - labelExpression (string): Expression to use for label generation if \"dimension\" is not set.\n+ */\n+class DimensionsMenuImplementation extends AbstractMenuImplementation\n+{\n+\n+    /**\n+     * @Flow\\Inject\n+     * @var ConfigurationContentDimensionPresetSource\n+     */\n+    protected $configurationContentDimensionPresetSource;\n+\n+    /**\n+     * @Flow\\Inject\n+     * @var ContentDimensionCombinator\n+     */\n+    protected $contentDimensionCombinator;\n+\n+    /**\n+     * @Flow\\Inject(lazy=false)\n+     * @var \\TYPO3\\Eel\\EelEvaluatorInterface\n+     */\n+    protected $eelEvaluator;\n+\n+    /**\n+     * @Flow\\InjectConfiguration(package=\"TYPO3.TYPO3CR\", path=\"labelGenerator.eel.defaultContext\")\n+     * @var array\n+     */\n+    protected $defaultContextConfiguration;\n+\n+    /**\n+     * @return string\n+     */\n+    public function getDimension()\n+    {\n+        return $this->tsValue('dimension');\n+    }\n+\n+    /**\n+     * @return array\n+     */\n+    public function getPresets()\n+    {\n+        return $this->tsValue('presets');\n+    }\n+\n+    /**\n+     * @return array\n+     */\n+    public function getIncludeAllPresets()\n+    {\n+        return $this->tsValue('includeAllPresets');\n+    }\n+\n+    /**\n+     * @return string\n+     */\n+    public function getLabelExpression()\n+    {\n+        return $this->tsValue('labelExpression');\n+    }\n+\n+    /**\n+     * Builds the array of Menu items for this variant menu\n+     */\n+    protected function buildItems()\n+    {\n+        $menuItems = [];\n+        $targetDimensionsToMatch = [];\n+        $allDimensionPresets = $this->configurationContentDimensionPresetSource->getAllPresets();\n+        $includeAllPresets = $this->getIncludeAllPresets();\n+        $pinnedDimensionValues = $this->getPresets();\n+\n+        $pinnedDimensionName = $this->getDimension();\n+        if ($pinnedDimensionName !== null) {\n+            $targetDimensionsToMatch = $this->currentNode->getContext()->getTargetDimensions();\n+            unset($targetDimensionsToMatch[$pinnedDimensionName]);\n+        }\n+\n+        foreach ($this->contentDimensionCombinator->getAllAllowedCombinations() as $allowedCombination) {\n+            $targetDimensions = $this->calculateTargetDimensionsForCombination($allowedCombination);\n+\n+            if ($pinnedDimensionName !== null && is_array($pinnedDimensionValues)) {\n+                if (!in_array($targetDimensions[$pinnedDimensionName], $pinnedDimensionValues)) {\n+                    continue;\n+                }\n+            }\n+\n+            // skip variants not matching the current target dimensions (except the dimension this menu covers)\n+            if ($targetDimensionsToMatch !== []) {\n+                foreach ($targetDimensionsToMatch as $dimensionName => $dimensionValue) {\n+                    if ($targetDimensions[$dimensionName] !== $dimensionValue) {\n+                        continue 2;\n+                    }\n+                }\n+            }","path":"TYPO3.Neos/Classes/TYPO3/Neos/TypoScript/DimensionsMenuImplementation.php","position":118,"original_position":118,"commit_id":"112243f90dba1c20ecc528335e01739c7e140b88","original_commit_id":"112243f90dba1c20ecc528335e01739c7e140b88","user":{"login":"kdambekalns","id":95873,"avatar_url":"https://avatars.githubusercontent.com/u/95873?v=3","gravatar_id":"","url":"https://api.github.com/users/kdambekalns","html_url":"https://github.com/kdambekalns","followers_url":"https://api.github.com/users/kdambekalns/followers","following_url":"https://api.github.com/users/kdambekalns/following{/other_user}","gists_url":"https://api.github.com/users/kdambekalns/gists{/gist_id}","starred_url":"https://api.github.com/users/kdambekalns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdambekalns/subscriptions","organizations_url":"https://api.github.com/users/kdambekalns/orgs","repos_url":"https://api.github.com/users/kdambekalns/repos","events_url":"https://api.github.com/users/kdambekalns/events{/privacy}","received_events_url":"https://api.github.com/users/kdambekalns/received_events","type":"User","site_admin":false},"body":"TBH I didn't really find `getAllowedDimensionPresetsAccordingToPreselection` useful for what I tried to do with it. The whole dimension/preset handling is rather inconsistent in itself (array of values vs. plain values for example).\r\n\r\nFeel free to educate me!","created_at":"2016-05-20T13:38:52Z","updated_at":"2016-05-20T13:38:52Z","html_url":"https://github.com/neos/neos-development-collection/pull/282#discussion_r64042111","pull_request_url":"https://api.github.com/repos/neos/neos-development-collection/pulls/282","_links":{"self":{"href":"https://api.github.com/repos/neos/neos-development-collection/pulls/comments/64042111"},"html":{"href":"https://github.com/neos/neos-development-collection/pull/282#discussion_r64042111"},"pull_request":{"href":"https://api.github.com/repos/neos/neos-development-collection/pulls/282"}}},"pull_request":{"url":"https://api.github.com/repos/neos/neos-development-collection/pulls/282","id":53874358,"html_url":"https://github.com/neos/neos-development-collection/pull/282","diff_url":"https://github.com/neos/neos-development-collection/pull/282.diff","patch_url":"https://github.com/neos/neos-development-collection/pull/282.patch","issue_url":"https://api.github.com/repos/neos/neos-development-collection/issues/282","number":282,"state":"open","locked":false,"title":"FEATURE: DimensionsMenu to handle multiple dimensions switching","user":{"login":"kitsunet","id":324408,"avatar_url":"https://avatars.githubusercontent.com/u/324408?v=3","gravatar_id":"","url":"https://api.github.com/users/kitsunet","html_url":"https://github.com/kitsunet","followers_url":"https://api.github.com/users/kitsunet/followers","following_url":"https://api.github.com/users/kitsunet/following{/other_user}","gists_url":"https://api.github.com/users/kitsunet/gists{/gist_id}","starred_url":"https://api.github.com/users/kitsunet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitsunet/subscriptions","organizations_url":"https://api.github.com/users/kitsunet/orgs","repos_url":"https://api.github.com/users/kitsunet/repos","events_url":"https://api.github.com/users/kitsunet/events{/privacy}","received_events_url":"https://api.github.com/users/kitsunet/received_events","type":"User","site_admin":false},"body":"This implements a DimensionsMenu that can render all available node variants\r\nfor possible dimension combinations.\r\n\r\nIt is a drop-in replacement for the existing DimensionMenu but keeps other active\r\ndimensions in the generated links.","created_at":"2015-12-16T17:45:43Z","updated_at":"2016-05-20T13:38:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"366bc6b97319f4001301a8653eec69e2c1a9789d","assignee":{"login":"kdambekalns","id":95873,"avatar_url":"https://avatars.githubusercontent.com/u/95873?v=3","gravatar_id":"","url":"https://api.github.com/users/kdambekalns","html_url":"https://github.com/kdambekalns","followers_url":"https://api.github.com/users/kdambekalns/followers","following_url":"https://api.github.com/users/kdambekalns/following{/other_user}","gists_url":"https://api.github.com/users/kdambekalns/gists{/gist_id}","starred_url":"https://api.github.com/users/kdambekalns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdambekalns/subscriptions","organizations_url":"https://api.github.com/users/kdambekalns/orgs","repos_url":"https://api.github.com/users/kdambekalns/repos","events_url":"https://api.github.com/users/kdambekalns/events{/privacy}","received_events_url":"https://api.github.com/users/kdambekalns/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/neos/neos-development-collection/pulls/282/commits","review_comments_url":"https://api.github.com/repos/neos/neos-development-collection/pulls/282/comments","review_comment_url":"https://api.github.com/repos/neos/neos-development-collection/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neos/neos-development-collection/issues/282/comments","statuses_url":"https://api.github.com/repos/neos/neos-development-collection/statuses/112243f90dba1c20ecc528335e01739c7e140b88","head":{"label":"kitsunet:variant-menu","ref":"variant-menu","sha":"112243f90dba1c20ecc528335e01739c7e140b88","user":{"login":"kitsunet","id":324408,"avatar_url":"https://avatars.githubusercontent.com/u/324408?v=3","gravatar_id":"","url":"https://api.github.com/users/kitsunet","html_url":"https://github.com/kitsunet","followers_url":"https://api.github.com/users/kitsunet/followers","following_url":"https://api.github.com/users/kitsunet/following{/other_user}","gists_url":"https://api.github.com/users/kitsunet/gists{/gist_id}","starred_url":"https://api.github.com/users/kitsunet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitsunet/subscriptions","organizations_url":"https://api.github.com/users/kitsunet/orgs","repos_url":"https://api.github.com/users/kitsunet/repos","events_url":"https://api.github.com/users/kitsunet/events{/privacy}","received_events_url":"https://api.github.com/users/kitsunet/received_events","type":"User","site_admin":false},"repo":{"id":41028866,"name":"neos-development-collection","full_name":"kitsunet/neos-development-collection","owner":{"login":"kitsunet","id":324408,"avatar_url":"https://avatars.githubusercontent.com/u/324408?v=3","gravatar_id":"","url":"https://api.github.com/users/kitsunet","html_url":"https://github.com/kitsunet","followers_url":"https://api.github.com/users/kitsunet/followers","following_url":"https://api.github.com/users/kitsunet/following{/other_user}","gists_url":"https://api.github.com/users/kitsunet/gists{/gist_id}","starred_url":"https://api.github.com/users/kitsunet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitsunet/subscriptions","organizations_url":"https://api.github.com/users/kitsunet/orgs","repos_url":"https://api.github.com/users/kitsunet/repos","events_url":"https://api.github.com/users/kitsunet/events{/privacy}","received_events_url":"https://api.github.com/users/kitsunet/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kitsunet/neos-development-collection","description":"The unified repository containing the Neos core packages, used for Neos development.","fork":true,"url":"https://api.github.com/repos/kitsunet/neos-development-collection","forks_url":"https://api.github.com/repos/kitsunet/neos-development-collection/forks","keys_url":"https://api.github.com/repos/kitsunet/neos-development-collection/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kitsunet/neos-development-collection/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kitsunet/neos-development-collection/teams","hooks_url":"https://api.github.com/repos/kitsunet/neos-development-collection/hooks","issue_events_url":"https://api.github.com/repos/kitsunet/neos-development-collection/issues/events{/number}","events_url":"https://api.github.com/repos/kitsunet/neos-development-collection/events","assignees_url":"https://api.github.com/repos/kitsunet/neos-development-collection/assignees{/user}","branches_url":"https://api.github.com/repos/kitsunet/neos-development-collection/branches{/branch}","tags_url":"https://api.github.com/repos/kitsunet/neos-development-collection/tags","blobs_url":"https://api.github.com/repos/kitsunet/neos-development-collection/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kitsunet/neos-development-collection/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kitsunet/neos-development-collection/git/refs{/sha}","trees_url":"https://api.github.com/repos/kitsunet/neos-development-collection/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kitsunet/neos-development-collection/statuses/{sha}","languages_url":"https://api.github.com/repos/kitsunet/neos-development-collection/languages","stargazers_url":"https://api.github.com/repos/kitsunet/neos-development-collection/stargazers","contributors_url":"https://api.github.com/repos/kitsunet/neos-development-collection/contributors","subscribers_url":"https://api.github.com/repos/kitsunet/neos-development-collection/subscribers","subscription_url":"https://api.github.com/repos/kitsunet/neos-development-collection/subscription","commits_url":"https://api.github.com/repos/kitsunet/neos-development-collection/commits{/sha}","git_commits_url":"https://api.github.com/repos/kitsunet/neos-development-collection/git/commits{/sha}","comments_url":"https://api.github.com/repos/kitsunet/neos-development-collection/comments{/number}","issue_comment_url":"https://api.github.com/repos/kitsunet/neos-development-collection/issues/comments{/number}","contents_url":"https://api.github.com/repos/kitsunet/neos-development-collection/contents/{+path}","compare_url":"https://api.github.com/repos/kitsunet/neos-development-collection/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kitsunet/neos-development-collection/merges","archive_url":"https://api.github.com/repos/kitsunet/neos-development-collection/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kitsunet/neos-development-collection/downloads","issues_url":"https://api.github.com/repos/kitsunet/neos-development-collection/issues{/number}","pulls_url":"https://api.github.com/repos/kitsunet/neos-development-collection/pulls{/number}","milestones_url":"https://api.github.com/repos/kitsunet/neos-development-collection/milestones{/number}","notifications_url":"https://api.github.com/repos/kitsunet/neos-development-collection/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kitsunet/neos-development-collection/labels{/name}","releases_url":"https://api.github.com/repos/kitsunet/neos-development-collection/releases{/id}","deployments_url":"https://api.github.com/repos/kitsunet/neos-development-collection/deployments","created_at":"2015-08-19T10:55:44Z","updated_at":"2015-08-19T10:55:49Z","pushed_at":"2016-05-19T16:14:48Z","git_url":"git://github.com/kitsunet/neos-development-collection.git","ssh_url":"git@github.com:kitsunet/neos-development-collection.git","clone_url":"https://github.com/kitsunet/neos-development-collection.git","svn_url":"https://github.com/kitsunet/neos-development-collection","homepage":null,"size":57952,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"neos:master","ref":"master","sha":"767230600d8049be11752d1239c428b786166d05","user":{"login":"neos","id":11575267,"avatar_url":"https://avatars.githubusercontent.com/u/11575267?v=3","gravatar_id":"","url":"https://api.github.com/users/neos","html_url":"https://github.com/neos","followers_url":"https://api.github.com/users/neos/followers","following_url":"https://api.github.com/users/neos/following{/other_user}","gists_url":"https://api.github.com/users/neos/gists{/gist_id}","starred_url":"https://api.github.com/users/neos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neos/subscriptions","organizations_url":"https://api.github.com/users/neos/orgs","repos_url":"https://api.github.com/users/neos/repos","events_url":"https://api.github.com/users/neos/events{/privacy}","received_events_url":"https://api.github.com/users/neos/received_events","type":"Organization","site_admin":false},"repo":{"id":40964014,"name":"neos-development-collection","full_name":"neos/neos-development-collection","owner":{"login":"neos","id":11575267,"avatar_url":"https://avatars.githubusercontent.com/u/11575267?v=3","gravatar_id":"","url":"https://api.github.com/users/neos","html_url":"https://github.com/neos","followers_url":"https://api.github.com/users/neos/followers","following_url":"https://api.github.com/users/neos/following{/other_user}","gists_url":"https://api.github.com/users/neos/gists{/gist_id}","starred_url":"https://api.github.com/users/neos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neos/subscriptions","organizations_url":"https://api.github.com/users/neos/orgs","repos_url":"https://api.github.com/users/neos/repos","events_url":"https://api.github.com/users/neos/events{/privacy}","received_events_url":"https://api.github.com/users/neos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neos/neos-development-collection","description":"The unified repository containing the Neos core packages, used for Neos development.","fork":false,"url":"https://api.github.com/repos/neos/neos-development-collection","forks_url":"https://api.github.com/repos/neos/neos-development-collection/forks","keys_url":"https://api.github.com/repos/neos/neos-development-collection/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neos/neos-development-collection/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neos/neos-development-collection/teams","hooks_url":"https://api.github.com/repos/neos/neos-development-collection/hooks","issue_events_url":"https://api.github.com/repos/neos/neos-development-collection/issues/events{/number}","events_url":"https://api.github.com/repos/neos/neos-development-collection/events","assignees_url":"https://api.github.com/repos/neos/neos-development-collection/assignees{/user}","branches_url":"https://api.github.com/repos/neos/neos-development-collection/branches{/branch}","tags_url":"https://api.github.com/repos/neos/neos-development-collection/tags","blobs_url":"https://api.github.com/repos/neos/neos-development-collection/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neos/neos-development-collection/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neos/neos-development-collection/git/refs{/sha}","trees_url":"https://api.github.com/repos/neos/neos-development-collection/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neos/neos-development-collection/statuses/{sha}","languages_url":"https://api.github.com/repos/neos/neos-development-collection/languages","stargazers_url":"https://api.github.com/repos/neos/neos-development-collection/stargazers","contributors_url":"https://api.github.com/repos/neos/neos-development-collection/contributors","subscribers_url":"https://api.github.com/repos/neos/neos-development-collection/subscribers","subscription_url":"https://api.github.com/repos/neos/neos-development-collection/subscription","commits_url":"https://api.github.com/repos/neos/neos-development-collection/commits{/sha}","git_commits_url":"https://api.github.com/repos/neos/neos-development-collection/git/commits{/sha}","comments_url":"https://api.github.com/repos/neos/neos-development-collection/comments{/number}","issue_comment_url":"https://api.github.com/repos/neos/neos-development-collection/issues/comments{/number}","contents_url":"https://api.github.com/repos/neos/neos-development-collection/contents/{+path}","compare_url":"https://api.github.com/repos/neos/neos-development-collection/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neos/neos-development-collection/merges","archive_url":"https://api.github.com/repos/neos/neos-development-collection/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neos/neos-development-collection/downloads","issues_url":"https://api.github.com/repos/neos/neos-development-collection/issues{/number}","pulls_url":"https://api.github.com/repos/neos/neos-development-collection/pulls{/number}","milestones_url":"https://api.github.com/repos/neos/neos-development-collection/milestones{/number}","notifications_url":"https://api.github.com/repos/neos/neos-development-collection/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neos/neos-development-collection/labels{/name}","releases_url":"https://api.github.com/repos/neos/neos-development-collection/releases{/id}","deployments_url":"https://api.github.com/repos/neos/neos-development-collection/deployments","created_at":"2015-08-18T09:48:35Z","updated_at":"2016-05-20T00:14:14Z","pushed_at":"2016-05-20T10:40:29Z","git_url":"git://github.com/neos/neos-development-collection.git","ssh_url":"git@github.com:neos/neos-development-collection.git","clone_url":"https://github.com/neos/neos-development-collection.git","svn_url":"https://github.com/neos/neos-development-collection","homepage":"https://www.neos.io/","size":70129,"stargazers_count":80,"watchers_count":80,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":66,"mirror_url":null,"open_issues_count":36,"forks":66,"open_issues":36,"watchers":80,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/neos/neos-development-collection/pulls/282"},"html":{"href":"https://github.com/neos/neos-development-collection/pull/282"},"issue":{"href":"https://api.github.com/repos/neos/neos-development-collection/issues/282"},"comments":{"href":"https://api.github.com/repos/neos/neos-development-collection/issues/282/comments"},"review_comments":{"href":"https://api.github.com/repos/neos/neos-development-collection/pulls/282/comments"},"review_comment":{"href":"https://api.github.com/repos/neos/neos-development-collection/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neos/neos-development-collection/pulls/282/commits"},"statuses":{"href":"https://api.github.com/repos/neos/neos-development-collection/statuses/112243f90dba1c20ecc528335e01739c7e140b88"}}}}
{"actor":{"display_login":"kdambekalns"}}