{"action":"created","comment":{"url":"https://api.github.com/repos/drupal-media/entity_browser/pulls/comments/57762557","id":57762557,"diff_hunk":"@@ -0,0 +1,38 @@\n+<?php\n+\n+/**\n+ * @file\n+ * Contains \\Drupal\\entity_browser\\Plugin\\EntityBrowser\\WidgetValidation\\EntityType.\n+ */\n+\n+namespace Drupal\\entity_browser\\Plugin\\EntityBrowser\\WidgetValidation;\n+\n+use Drupal\\entity_browser\\WidgetValidationBase;\n+use Symfony\\Component\\Validator\\ConstraintViolationList;\n+\n+/**\n+ * Validates that the widget returns the appropriate number of elements.\n+ *\n+ * @EntityBrowserWidgetValidation(\n+ *   id = \"entity_type\",\n+ *   label = @Translation(\"Entity type validator\"),\n+ * )\n+ */\n+class EntityType extends WidgetValidationBase {\n+  /**\n+   * {@inheritdoc}\n+   */\n+  public function validate(array $entities, $options = []) {\n+    $data_definition = \\Drupal::typedDataManager()->createDataDefinition('entity_reference');\n+    $plugin_definition = $this->getPluginDefinition();\n+    $data_definition->addConstraint($plugin_definition['constraint'], $options);\n+\n+    $violations = new ConstraintViolationList([]);\n+    foreach ($entities as $entity) {\n+      $validation_result = \\Drupal::typedDataManager()->create($data_definition, $entity)->validate();","path":"src/Plugin/EntityBrowser/WidgetValidation/EntityType.php","position":32,"original_position":32,"commit_id":"80d2e0921f6cffb72b9195ec886b1d7c83324c85","original_commit_id":"80d2e0921f6cffb72b9195ec886b1d7c83324c85","user":{"login":"slashrsm","id":376889,"avatar_url":"https://avatars.githubusercontent.com/u/376889?v=3","gravatar_id":"","url":"https://api.github.com/users/slashrsm","html_url":"https://github.com/slashrsm","followers_url":"https://api.github.com/users/slashrsm/followers","following_url":"https://api.github.com/users/slashrsm/following{/other_user}","gists_url":"https://api.github.com/users/slashrsm/gists{/gist_id}","starred_url":"https://api.github.com/users/slashrsm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slashrsm/subscriptions","organizations_url":"https://api.github.com/users/slashrsm/orgs","repos_url":"https://api.github.com/users/slashrsm/repos","events_url":"https://api.github.com/users/slashrsm/events{/privacy}","received_events_url":"https://api.github.com/users/slashrsm/received_events","type":"User","site_admin":false},"body":"Inject?","created_at":"2016-03-29T17:19:52Z","updated_at":"2016-03-29T17:19:52Z","html_url":"https://github.com/drupal-media/entity_browser/pull/117#discussion_r57762557","pull_request_url":"https://api.github.com/repos/drupal-media/entity_browser/pulls/117","_links":{"self":{"href":"https://api.github.com/repos/drupal-media/entity_browser/pulls/comments/57762557"},"html":{"href":"https://github.com/drupal-media/entity_browser/pull/117#discussion_r57762557"},"pull_request":{"href":"https://api.github.com/repos/drupal-media/entity_browser/pulls/117"}}},"pull_request":{"url":"https://api.github.com/repos/drupal-media/entity_browser/pulls/117","id":52040554,"html_url":"https://github.com/drupal-media/entity_browser/pull/117","diff_url":"https://github.com/drupal-media/entity_browser/pull/117.diff","patch_url":"https://github.com/drupal-media/entity_browser/pull/117.patch","issue_url":"https://api.github.com/repos/drupal-media/entity_browser/issues/117","number":117,"state":"open","locked":false,"title":"Issue #2366335 by Primsi: Support defining conditions","user":{"login":"primsi","id":5868171,"avatar_url":"https://avatars.githubusercontent.com/u/5868171?v=3","gravatar_id":"","url":"https://api.github.com/users/primsi","html_url":"https://github.com/primsi","followers_url":"https://api.github.com/users/primsi/followers","following_url":"https://api.github.com/users/primsi/following{/other_user}","gists_url":"https://api.github.com/users/primsi/gists{/gist_id}","starred_url":"https://api.github.com/users/primsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/primsi/subscriptions","organizations_url":"https://api.github.com/users/primsi/orgs","repos_url":"https://api.github.com/users/primsi/repos","events_url":"https://api.github.com/users/primsi/events{/privacy}","received_events_url":"https://api.github.com/users/primsi/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-28T13:31:27Z","updated_at":"2016-03-29T17:19:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1220342418c6cf6c6f18a2d66011af5270d2df07","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/drupal-media/entity_browser/pulls/117/commits","review_comments_url":"https://api.github.com/repos/drupal-media/entity_browser/pulls/117/comments","review_comment_url":"https://api.github.com/repos/drupal-media/entity_browser/pulls/comments{/number}","comments_url":"https://api.github.com/repos/drupal-media/entity_browser/issues/117/comments","statuses_url":"https://api.github.com/repos/drupal-media/entity_browser/statuses/80d2e0921f6cffb72b9195ec886b1d7c83324c85","head":{"label":"primsi:2366335_condition","ref":"2366335_condition","sha":"80d2e0921f6cffb72b9195ec886b1d7c83324c85","user":{"login":"primsi","id":5868171,"avatar_url":"https://avatars.githubusercontent.com/u/5868171?v=3","gravatar_id":"","url":"https://api.github.com/users/primsi","html_url":"https://github.com/primsi","followers_url":"https://api.github.com/users/primsi/followers","following_url":"https://api.github.com/users/primsi/following{/other_user}","gists_url":"https://api.github.com/users/primsi/gists{/gist_id}","starred_url":"https://api.github.com/users/primsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/primsi/subscriptions","organizations_url":"https://api.github.com/users/primsi/orgs","repos_url":"https://api.github.com/users/primsi/repos","events_url":"https://api.github.com/users/primsi/events{/privacy}","received_events_url":"https://api.github.com/users/primsi/received_events","type":"User","site_admin":false},"repo":{"id":28641900,"name":"entity_browser","full_name":"primsi/entity_browser","owner":{"login":"primsi","id":5868171,"avatar_url":"https://avatars.githubusercontent.com/u/5868171?v=3","gravatar_id":"","url":"https://api.github.com/users/primsi","html_url":"https://github.com/primsi","followers_url":"https://api.github.com/users/primsi/followers","following_url":"https://api.github.com/users/primsi/following{/other_user}","gists_url":"https://api.github.com/users/primsi/gists{/gist_id}","starred_url":"https://api.github.com/users/primsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/primsi/subscriptions","organizations_url":"https://api.github.com/users/primsi/orgs","repos_url":"https://api.github.com/users/primsi/repos","events_url":"https://api.github.com/users/primsi/events{/privacy}","received_events_url":"https://api.github.com/users/primsi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/primsi/entity_browser","description":"Allows entities to be selected using a tabbed browser interface.","fork":true,"url":"https://api.github.com/repos/primsi/entity_browser","forks_url":"https://api.github.com/repos/primsi/entity_browser/forks","keys_url":"https://api.github.com/repos/primsi/entity_browser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/primsi/entity_browser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/primsi/entity_browser/teams","hooks_url":"https://api.github.com/repos/primsi/entity_browser/hooks","issue_events_url":"https://api.github.com/repos/primsi/entity_browser/issues/events{/number}","events_url":"https://api.github.com/repos/primsi/entity_browser/events","assignees_url":"https://api.github.com/repos/primsi/entity_browser/assignees{/user}","branches_url":"https://api.github.com/repos/primsi/entity_browser/branches{/branch}","tags_url":"https://api.github.com/repos/primsi/entity_browser/tags","blobs_url":"https://api.github.com/repos/primsi/entity_browser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/primsi/entity_browser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/primsi/entity_browser/git/refs{/sha}","trees_url":"https://api.github.com/repos/primsi/entity_browser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/primsi/entity_browser/statuses/{sha}","languages_url":"https://api.github.com/repos/primsi/entity_browser/languages","stargazers_url":"https://api.github.com/repos/primsi/entity_browser/stargazers","contributors_url":"https://api.github.com/repos/primsi/entity_browser/contributors","subscribers_url":"https://api.github.com/repos/primsi/entity_browser/subscribers","subscription_url":"https://api.github.com/repos/primsi/entity_browser/subscription","commits_url":"https://api.github.com/repos/primsi/entity_browser/commits{/sha}","git_commits_url":"https://api.github.com/repos/primsi/entity_browser/git/commits{/sha}","comments_url":"https://api.github.com/repos/primsi/entity_browser/comments{/number}","issue_comment_url":"https://api.github.com/repos/primsi/entity_browser/issues/comments{/number}","contents_url":"https://api.github.com/repos/primsi/entity_browser/contents/{+path}","compare_url":"https://api.github.com/repos/primsi/entity_browser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/primsi/entity_browser/merges","archive_url":"https://api.github.com/repos/primsi/entity_browser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/primsi/entity_browser/downloads","issues_url":"https://api.github.com/repos/primsi/entity_browser/issues{/number}","pulls_url":"https://api.github.com/repos/primsi/entity_browser/pulls{/number}","milestones_url":"https://api.github.com/repos/primsi/entity_browser/milestones{/number}","notifications_url":"https://api.github.com/repos/primsi/entity_browser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/primsi/entity_browser/labels{/name}","releases_url":"https://api.github.com/repos/primsi/entity_browser/releases{/id}","deployments_url":"https://api.github.com/repos/primsi/entity_browser/deployments","created_at":"2014-12-30T19:03:57Z","updated_at":"2015-01-13T13:21:37Z","pushed_at":"2016-03-15T14:01:36Z","git_url":"git://github.com/primsi/entity_browser.git","ssh_url":"git@github.com:primsi/entity_browser.git","clone_url":"https://github.com/primsi/entity_browser.git","svn_url":"https://github.com/primsi/entity_browser","homepage":null,"size":582,"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":"8.x-1.x"}},"base":{"label":"drupal-media:8.x-1.x","ref":"8.x-1.x","sha":"0bbdb6ba76c1db0abd95ce8a395c296376c39c2f","user":{"login":"drupal-media","id":7276699,"avatar_url":"https://avatars.githubusercontent.com/u/7276699?v=3","gravatar_id":"","url":"https://api.github.com/users/drupal-media","html_url":"https://github.com/drupal-media","followers_url":"https://api.github.com/users/drupal-media/followers","following_url":"https://api.github.com/users/drupal-media/following{/other_user}","gists_url":"https://api.github.com/users/drupal-media/gists{/gist_id}","starred_url":"https://api.github.com/users/drupal-media/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drupal-media/subscriptions","organizations_url":"https://api.github.com/users/drupal-media/orgs","repos_url":"https://api.github.com/users/drupal-media/repos","events_url":"https://api.github.com/users/drupal-media/events{/privacy}","received_events_url":"https://api.github.com/users/drupal-media/received_events","type":"Organization","site_admin":false},"repo":{"id":18717787,"name":"entity_browser","full_name":"drupal-media/entity_browser","owner":{"login":"drupal-media","id":7276699,"avatar_url":"https://avatars.githubusercontent.com/u/7276699?v=3","gravatar_id":"","url":"https://api.github.com/users/drupal-media","html_url":"https://github.com/drupal-media","followers_url":"https://api.github.com/users/drupal-media/followers","following_url":"https://api.github.com/users/drupal-media/following{/other_user}","gists_url":"https://api.github.com/users/drupal-media/gists{/gist_id}","starred_url":"https://api.github.com/users/drupal-media/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drupal-media/subscriptions","organizations_url":"https://api.github.com/users/drupal-media/orgs","repos_url":"https://api.github.com/users/drupal-media/repos","events_url":"https://api.github.com/users/drupal-media/events{/privacy}","received_events_url":"https://api.github.com/users/drupal-media/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/drupal-media/entity_browser","description":"Allows entities to be selected using a tabbed browser interface.","fork":false,"url":"https://api.github.com/repos/drupal-media/entity_browser","forks_url":"https://api.github.com/repos/drupal-media/entity_browser/forks","keys_url":"https://api.github.com/repos/drupal-media/entity_browser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/drupal-media/entity_browser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/drupal-media/entity_browser/teams","hooks_url":"https://api.github.com/repos/drupal-media/entity_browser/hooks","issue_events_url":"https://api.github.com/repos/drupal-media/entity_browser/issues/events{/number}","events_url":"https://api.github.com/repos/drupal-media/entity_browser/events","assignees_url":"https://api.github.com/repos/drupal-media/entity_browser/assignees{/user}","branches_url":"https://api.github.com/repos/drupal-media/entity_browser/branches{/branch}","tags_url":"https://api.github.com/repos/drupal-media/entity_browser/tags","blobs_url":"https://api.github.com/repos/drupal-media/entity_browser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/drupal-media/entity_browser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/drupal-media/entity_browser/git/refs{/sha}","trees_url":"https://api.github.com/repos/drupal-media/entity_browser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/drupal-media/entity_browser/statuses/{sha}","languages_url":"https://api.github.com/repos/drupal-media/entity_browser/languages","stargazers_url":"https://api.github.com/repos/drupal-media/entity_browser/stargazers","contributors_url":"https://api.github.com/repos/drupal-media/entity_browser/contributors","subscribers_url":"https://api.github.com/repos/drupal-media/entity_browser/subscribers","subscription_url":"https://api.github.com/repos/drupal-media/entity_browser/subscription","commits_url":"https://api.github.com/repos/drupal-media/entity_browser/commits{/sha}","git_commits_url":"https://api.github.com/repos/drupal-media/entity_browser/git/commits{/sha}","comments_url":"https://api.github.com/repos/drupal-media/entity_browser/comments{/number}","issue_comment_url":"https://api.github.com/repos/drupal-media/entity_browser/issues/comments{/number}","contents_url":"https://api.github.com/repos/drupal-media/entity_browser/contents/{+path}","compare_url":"https://api.github.com/repos/drupal-media/entity_browser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/drupal-media/entity_browser/merges","archive_url":"https://api.github.com/repos/drupal-media/entity_browser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/drupal-media/entity_browser/downloads","issues_url":"https://api.github.com/repos/drupal-media/entity_browser/issues{/number}","pulls_url":"https://api.github.com/repos/drupal-media/entity_browser/pulls{/number}","milestones_url":"https://api.github.com/repos/drupal-media/entity_browser/milestones{/number}","notifications_url":"https://api.github.com/repos/drupal-media/entity_browser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/drupal-media/entity_browser/labels{/name}","releases_url":"https://api.github.com/repos/drupal-media/entity_browser/releases{/id}","deployments_url":"https://api.github.com/repos/drupal-media/entity_browser/deployments","created_at":"2014-04-13T00:10:26Z","updated_at":"2016-02-20T16:07:37Z","pushed_at":"2016-03-24T08:51:18Z","git_url":"git://github.com/drupal-media/entity_browser.git","ssh_url":"git@github.com:drupal-media/entity_browser.git","clone_url":"https://github.com/drupal-media/entity_browser.git","svn_url":"https://github.com/drupal-media/entity_browser","homepage":"https://www.drupal.org/project/entity_browser","size":697,"stargazers_count":19,"watchers_count":19,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":9,"forks":30,"open_issues":9,"watchers":19,"default_branch":"8.x-1.x"}},"_links":{"self":{"href":"https://api.github.com/repos/drupal-media/entity_browser/pulls/117"},"html":{"href":"https://github.com/drupal-media/entity_browser/pull/117"},"issue":{"href":"https://api.github.com/repos/drupal-media/entity_browser/issues/117"},"comments":{"href":"https://api.github.com/repos/drupal-media/entity_browser/issues/117/comments"},"review_comments":{"href":"https://api.github.com/repos/drupal-media/entity_browser/pulls/117/comments"},"review_comment":{"href":"https://api.github.com/repos/drupal-media/entity_browser/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/drupal-media/entity_browser/pulls/117/commits"},"statuses":{"href":"https://api.github.com/repos/drupal-media/entity_browser/statuses/80d2e0921f6cffb72b9195ec886b1d7c83324c85"}}}}