{"action":"created","comment":{"url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls/comments/26913653","id":26913653,"diff_hunk":"@@ -13,34 +13,38 @@\n class GridFieldSiteTreeAddNewButton extends GridFieldAddNewButton\r\n \timplements GridField_ActionProvider {\r\n \r\n-\r\n+\t/**\r\n+\t * Determine the list of classnames and titles allowed for a given parent object\r\n+\t *\r\n+\t * @param SiteTree $parent\r\n+\t * @return boolean\r\n+\t */\r\n \tpublic function getAllowedChildren(SiteTree $parent) {\r\n+\t\tif(!$parent->canAddChildren()) return array();\r\n \t\t$allowedChildren = $parent->allowedChildren();\r\n-\t\tif(empty($allowedChildren)) return array();\r\n-\r\n \t\t$children = array();\r\n \t\tforeach($allowedChildren as $class) {\r\n \t\t\tif(Config::inst()->get($class, \"show_in_sitetree\") === false) {\r\n-\t\t\t\t$children[$class] = Injector::inst()->create($class)->i18n_singular_name();\r\n+\t\t\t\t$instance = singleton($class);\r","path":"code/forms/gridfield/GridFieldSiteTreeAddNewButton.php","position":20,"original_position":20,"commit_id":"e61e9bda07295ad8ba871bfd864380af711fe46b","original_commit_id":"e61e9bda07295ad8ba871bfd864380af711fe46b","user":{"login":"tractorcow","id":936064,"avatar_url":"https://avatars.githubusercontent.com/u/936064?v=3","gravatar_id":"","url":"https://api.github.com/users/tractorcow","html_url":"https://github.com/tractorcow","followers_url":"https://api.github.com/users/tractorcow/followers","following_url":"https://api.github.com/users/tractorcow/following{/other_user}","gists_url":"https://api.github.com/users/tractorcow/gists{/gist_id}","starred_url":"https://api.github.com/users/tractorcow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tractorcow/subscriptions","organizations_url":"https://api.github.com/users/tractorcow/orgs","repos_url":"https://api.github.com/users/tractorcow/repos","events_url":"https://api.github.com/users/tractorcow/events{/privacy}","received_events_url":"https://api.github.com/users/tractorcow/received_events","type":"User","site_admin":false},"body":"Not that I heard of? If it ever does get deprecated we can replace it here.","created_at":"2015-03-23T04:11:55Z","updated_at":"2015-03-23T04:11:55Z","html_url":"https://github.com/silverstripe/silverstripe-lumberjack/pull/3#discussion_r26913653","pull_request_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls/comments/26913653"},"html":{"href":"https://github.com/silverstripe/silverstripe-lumberjack/pull/3#discussion_r26913653"},"pull_request":{"href":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls/3","id":31086668,"html_url":"https://github.com/silverstripe/silverstripe-lumberjack/pull/3","diff_url":"https://github.com/silverstripe/silverstripe-lumberjack/pull/3.diff","patch_url":"https://github.com/silverstripe/silverstripe-lumberjack/pull/3.patch","issue_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/issues/3","number":3,"state":"open","locked":false,"title":"FIX Hide page options the user is not permitted to create","user":{"login":"tractorcow","id":936064,"avatar_url":"https://avatars.githubusercontent.com/u/936064?v=3","gravatar_id":"","url":"https://api.github.com/users/tractorcow","html_url":"https://github.com/tractorcow","followers_url":"https://api.github.com/users/tractorcow/followers","following_url":"https://api.github.com/users/tractorcow/following{/other_user}","gists_url":"https://api.github.com/users/tractorcow/gists{/gist_id}","starred_url":"https://api.github.com/users/tractorcow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tractorcow/subscriptions","organizations_url":"https://api.github.com/users/tractorcow/orgs","repos_url":"https://api.github.com/users/tractorcow/repos","events_url":"https://api.github.com/users/tractorcow/events{/privacy}","received_events_url":"https://api.github.com/users/tractorcow/received_events","type":"User","site_admin":false},"body":"Instead of checking canCreate once on the getModelClass(), check on each subclass individually.\r\n\r\nThis is useful for cases where only some subclasses of SiteTree are available.","created_at":"2015-03-12T23:05:52Z","updated_at":"2015-03-23T04:11:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8cc9fa27fd9becd651783033f6d88521d745b6d2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls/3/commits","review_comments_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls/3/comments","review_comment_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/issues/3/comments","statuses_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/statuses/e61e9bda07295ad8ba871bfd864380af711fe46b","head":{"label":"tractorcow:pulls/1.1/fix-perms","ref":"pulls/1.1/fix-perms","sha":"e61e9bda07295ad8ba871bfd864380af711fe46b","user":{"login":"tractorcow","id":936064,"avatar_url":"https://avatars.githubusercontent.com/u/936064?v=3","gravatar_id":"","url":"https://api.github.com/users/tractorcow","html_url":"https://github.com/tractorcow","followers_url":"https://api.github.com/users/tractorcow/followers","following_url":"https://api.github.com/users/tractorcow/following{/other_user}","gists_url":"https://api.github.com/users/tractorcow/gists{/gist_id}","starred_url":"https://api.github.com/users/tractorcow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tractorcow/subscriptions","organizations_url":"https://api.github.com/users/tractorcow/orgs","repos_url":"https://api.github.com/users/tractorcow/repos","events_url":"https://api.github.com/users/tractorcow/events{/privacy}","received_events_url":"https://api.github.com/users/tractorcow/received_events","type":"User","site_admin":false},"repo":{"id":31688557,"name":"silverstripe-lumberjack","full_name":"tractorcow/silverstripe-lumberjack","owner":{"login":"tractorcow","id":936064,"avatar_url":"https://avatars.githubusercontent.com/u/936064?v=3","gravatar_id":"","url":"https://api.github.com/users/tractorcow","html_url":"https://github.com/tractorcow","followers_url":"https://api.github.com/users/tractorcow/followers","following_url":"https://api.github.com/users/tractorcow/following{/other_user}","gists_url":"https://api.github.com/users/tractorcow/gists{/gist_id}","starred_url":"https://api.github.com/users/tractorcow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tractorcow/subscriptions","organizations_url":"https://api.github.com/users/tractorcow/orgs","repos_url":"https://api.github.com/users/tractorcow/repos","events_url":"https://api.github.com/users/tractorcow/events{/privacy}","received_events_url":"https://api.github.com/users/tractorcow/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tractorcow/silverstripe-lumberjack","description":"Keep in control of large SiteTree's by using GridField to manage pages.","fork":true,"url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack","forks_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/forks","keys_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/teams","hooks_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/hooks","issue_events_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/issues/events{/number}","events_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/events","assignees_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/assignees{/user}","branches_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/branches{/branch}","tags_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/tags","blobs_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/git/refs{/sha}","trees_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/statuses/{sha}","languages_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/languages","stargazers_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/stargazers","contributors_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/contributors","subscribers_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/subscribers","subscription_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/subscription","commits_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/commits{/sha}","git_commits_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/git/commits{/sha}","comments_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/comments{/number}","issue_comment_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/issues/comments{/number}","contents_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/contents/{+path}","compare_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/merges","archive_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/downloads","issues_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/issues{/number}","pulls_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/pulls{/number}","milestones_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/milestones{/number}","notifications_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/labels{/name}","releases_url":"https://api.github.com/repos/tractorcow/silverstripe-lumberjack/releases{/id}","created_at":"2015-03-05T01:03:25Z","updated_at":"2015-03-15T22:21:11Z","pushed_at":"2015-03-22T23:03:20Z","git_url":"git://github.com/tractorcow/silverstripe-lumberjack.git","ssh_url":"git@github.com:tractorcow/silverstripe-lumberjack.git","clone_url":"https://github.com/tractorcow/silverstripe-lumberjack.git","svn_url":"https://github.com/tractorcow/silverstripe-lumberjack","homepage":null,"size":129,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"1.1"}},"base":{"label":"silverstripe:1.1","ref":"1.1","sha":"852f4c5bf6368f621169d8746ff3ca64671a9d7e","user":{"login":"silverstripe","id":379348,"avatar_url":"https://avatars.githubusercontent.com/u/379348?v=3","gravatar_id":"","url":"https://api.github.com/users/silverstripe","html_url":"https://github.com/silverstripe","followers_url":"https://api.github.com/users/silverstripe/followers","following_url":"https://api.github.com/users/silverstripe/following{/other_user}","gists_url":"https://api.github.com/users/silverstripe/gists{/gist_id}","starred_url":"https://api.github.com/users/silverstripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silverstripe/subscriptions","organizations_url":"https://api.github.com/users/silverstripe/orgs","repos_url":"https://api.github.com/users/silverstripe/repos","events_url":"https://api.github.com/users/silverstripe/events{/privacy}","received_events_url":"https://api.github.com/users/silverstripe/received_events","type":"Organization","site_admin":false},"repo":{"id":30332001,"name":"silverstripe-lumberjack","full_name":"silverstripe/silverstripe-lumberjack","owner":{"login":"silverstripe","id":379348,"avatar_url":"https://avatars.githubusercontent.com/u/379348?v=3","gravatar_id":"","url":"https://api.github.com/users/silverstripe","html_url":"https://github.com/silverstripe","followers_url":"https://api.github.com/users/silverstripe/followers","following_url":"https://api.github.com/users/silverstripe/following{/other_user}","gists_url":"https://api.github.com/users/silverstripe/gists{/gist_id}","starred_url":"https://api.github.com/users/silverstripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silverstripe/subscriptions","organizations_url":"https://api.github.com/users/silverstripe/orgs","repos_url":"https://api.github.com/users/silverstripe/repos","events_url":"https://api.github.com/users/silverstripe/events{/privacy}","received_events_url":"https://api.github.com/users/silverstripe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/silverstripe/silverstripe-lumberjack","description":"Keep in control of large SiteTree's by using GridField to manage pages.","fork":true,"url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack","forks_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/forks","keys_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/teams","hooks_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/hooks","issue_events_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/issues/events{/number}","events_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/events","assignees_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/assignees{/user}","branches_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/branches{/branch}","tags_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/tags","blobs_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/git/refs{/sha}","trees_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/statuses/{sha}","languages_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/languages","stargazers_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/stargazers","contributors_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/contributors","subscribers_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/subscribers","subscription_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/subscription","commits_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/commits{/sha}","git_commits_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/git/commits{/sha}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/comments{/number}","issue_comment_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/issues/comments{/number}","contents_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/contents/{+path}","compare_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/merges","archive_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/downloads","issues_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/issues{/number}","pulls_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls{/number}","milestones_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/milestones{/number}","notifications_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/labels{/name}","releases_url":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/releases{/id}","created_at":"2015-02-05T01:50:19Z","updated_at":"2015-03-10T20:23:00Z","pushed_at":"2015-03-22T23:03:20Z","git_url":"git://github.com/silverstripe/silverstripe-lumberjack.git","ssh_url":"git@github.com:silverstripe/silverstripe-lumberjack.git","clone_url":"https://github.com/silverstripe/silverstripe-lumberjack.git","svn_url":"https://github.com/silverstripe/silverstripe-lumberjack","homepage":null,"size":215,"stargazers_count":3,"watchers_count":3,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":3,"default_branch":"1.1"}},"_links":{"self":{"href":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls/3"},"html":{"href":"https://github.com/silverstripe/silverstripe-lumberjack/pull/3"},"issue":{"href":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/issues/3"},"comments":{"href":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/silverstripe/silverstripe-lumberjack/statuses/e61e9bda07295ad8ba871bfd864380af711fe46b"}}}}