{"action":"created","comment":{"url":"https://api.github.com/repos/bojanz/profile/pulls/comments/46887191","id":46887191,"diff_hunk":"@@ -103,19 +110,61 @@ public function addPageTitle(ProfileTypeInterface $profile_type) {\n   public function userProfileForm(RouteMatchInterface $route_match, UserInterface $user, ProfileTypeInterface $profile_type) {\n     /** @var \\Drupal\\profile\\Entity\\ProfileType $profile_type */\n \n+    /** @var \\Drupal\\profile\\Entity\\ProfileInterface|bool $active_profile */\n+    $active_profile = $this->entityTypeManager()->getStorage('profile')\n+                           ->loadByUser($user, $profile_type->id());\n+\n     // If the profile type does not support multiple, only display an add form\n     // if there are no entities, or an edit for the current.\n     if (!$profile_type->getMultiple()) {\n-      /** @var \\Drupal\\profile\\Entity\\ProfileInterface|bool $active_profile */\n-      $active_profile = $this->entityTypeManager()->getStorage('profile')\n-        ->loadByUser($user, $profile_type->id());\n \n+      // If there is an active profile, provide edit form.\n       if ($active_profile) {\n-        return $this->editProfile($user, $active_profile);\n+        return $this->editProfile($route_match, $user, $active_profile);\n       }\n+\n+      // Else show the add form.\n+      return $this->addProfile($route_match, $user, $profile_type);\n     }\n+    // Display active, inactive, and link to create a profile.\n+    else {\n+      $build = [];\n \n-    return $this->addProfile($user, $profile_type);\n+      $active_profiles = $this->entityTypeManager()->getStorage('profile')\n+                                ->loadMultipleByUser($user, $profile_type->id(), PROFILE_ACTIVE);\n+      $inactive_profiles = $this->entityTypeManager()->getStorage('profile')\n+                                ->loadMultipleByUser($user, $profile_type->id(), PROFILE_NOT_ACTIVE);\n+\n+      // If there is no active profile or inactive, display add form.\n+      if (!$active_profile && !$inactive_profiles) {\n+        return $this->addProfile($route_match, $user, $profile_type);\n+      }\n+\n+      $build['add_profile'] = Link::createFromRoute(\n+        $this->t('Add new @type', ['@type' => $profile_type->label()]),\n+        \"entity.profile.type.{$profile_type->id()}.user_profile_form.add\",\n+        ['user' => \\Drupal::currentUser()->id(), 'profile_type' => $profile_type->id()])\n+        ->toRenderable();\n+\n+      // Render the active profile.\n+      if ($active_profiles) {\n+        // List all inactive profiles.","path":"src/Controller/ProfileController.php","position":108,"original_position":108,"commit_id":"d81eb8a3d5adc8f303471c7aa8440ef41e6a5f86","original_commit_id":"d81eb8a3d5adc8f303471c7aa8440ef41e6a5f86","user":{"login":"mglaman","id":3698644,"avatar_url":"https://avatars.githubusercontent.com/u/3698644?v=3","gravatar_id":"","url":"https://api.github.com/users/mglaman","html_url":"https://github.com/mglaman","followers_url":"https://api.github.com/users/mglaman/followers","following_url":"https://api.github.com/users/mglaman/following{/other_user}","gists_url":"https://api.github.com/users/mglaman/gists{/gist_id}","starred_url":"https://api.github.com/users/mglaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mglaman/subscriptions","organizations_url":"https://api.github.com/users/mglaman/orgs","repos_url":"https://api.github.com/users/mglaman/repos","events_url":"https://api.github.com/users/mglaman/events{/privacy}","received_events_url":"https://api.github.com/users/mglaman/received_events","type":"User","site_admin":false},"body":"Remove","created_at":"2015-12-07T22:23:15Z","updated_at":"2015-12-07T22:23:15Z","html_url":"https://github.com/bojanz/profile/pull/22#discussion_r46887191","pull_request_url":"https://api.github.com/repos/bojanz/profile/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/bojanz/profile/pulls/comments/46887191"},"html":{"href":"https://github.com/bojanz/profile/pull/22#discussion_r46887191"},"pull_request":{"href":"https://api.github.com/repos/bojanz/profile/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/bojanz/profile/pulls/22","id":52881124,"html_url":"https://github.com/bojanz/profile/pull/22","diff_url":"https://github.com/bojanz/profile/pull/22.diff","patch_url":"https://github.com/bojanz/profile/pull/22.patch","issue_url":"https://api.github.com/repos/bojanz/profile/issues/22","number":22,"state":"open","locked":false,"title":"Issue #2629100: Support edit/create flow for profile types that suppo…","user":{"login":"mglaman","id":3698644,"avatar_url":"https://avatars.githubusercontent.com/u/3698644?v=3","gravatar_id":"","url":"https://api.github.com/users/mglaman","html_url":"https://github.com/mglaman","followers_url":"https://api.github.com/users/mglaman/followers","following_url":"https://api.github.com/users/mglaman/following{/other_user}","gists_url":"https://api.github.com/users/mglaman/gists{/gist_id}","starred_url":"https://api.github.com/users/mglaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mglaman/subscriptions","organizations_url":"https://api.github.com/users/mglaman/orgs","repos_url":"https://api.github.com/users/mglaman/repos","events_url":"https://api.github.com/users/mglaman/events{/privacy}","received_events_url":"https://api.github.com/users/mglaman/received_events","type":"User","site_admin":false},"body":"…rt multiple profiles","created_at":"2015-12-07T18:21:55Z","updated_at":"2015-12-07T22:23:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b586d5c0fe183bef89e366107f976d0c4cdbf7c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bojanz/profile/pulls/22/commits","review_comments_url":"https://api.github.com/repos/bojanz/profile/pulls/22/comments","review_comment_url":"https://api.github.com/repos/bojanz/profile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bojanz/profile/issues/22/comments","statuses_url":"https://api.github.com/repos/bojanz/profile/statuses/d81eb8a3d5adc8f303471c7aa8440ef41e6a5f86","head":{"label":"mglaman:support_edit_create-2629100","ref":"support_edit_create-2629100","sha":"d81eb8a3d5adc8f303471c7aa8440ef41e6a5f86","user":{"login":"mglaman","id":3698644,"avatar_url":"https://avatars.githubusercontent.com/u/3698644?v=3","gravatar_id":"","url":"https://api.github.com/users/mglaman","html_url":"https://github.com/mglaman","followers_url":"https://api.github.com/users/mglaman/followers","following_url":"https://api.github.com/users/mglaman/following{/other_user}","gists_url":"https://api.github.com/users/mglaman/gists{/gist_id}","starred_url":"https://api.github.com/users/mglaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mglaman/subscriptions","organizations_url":"https://api.github.com/users/mglaman/orgs","repos_url":"https://api.github.com/users/mglaman/repos","events_url":"https://api.github.com/users/mglaman/events{/privacy}","received_events_url":"https://api.github.com/users/mglaman/received_events","type":"User","site_admin":false},"repo":{"id":46351280,"name":"profile","full_name":"mglaman/profile","owner":{"login":"mglaman","id":3698644,"avatar_url":"https://avatars.githubusercontent.com/u/3698644?v=3","gravatar_id":"","url":"https://api.github.com/users/mglaman","html_url":"https://github.com/mglaman","followers_url":"https://api.github.com/users/mglaman/followers","following_url":"https://api.github.com/users/mglaman/following{/other_user}","gists_url":"https://api.github.com/users/mglaman/gists{/gist_id}","starred_url":"https://api.github.com/users/mglaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mglaman/subscriptions","organizations_url":"https://api.github.com/users/mglaman/orgs","repos_url":"https://api.github.com/users/mglaman/repos","events_url":"https://api.github.com/users/mglaman/events{/privacy}","received_events_url":"https://api.github.com/users/mglaman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mglaman/profile","description":"The GitHub mirror of the d.o profile project. PRs welcome.","fork":true,"url":"https://api.github.com/repos/mglaman/profile","forks_url":"https://api.github.com/repos/mglaman/profile/forks","keys_url":"https://api.github.com/repos/mglaman/profile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mglaman/profile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mglaman/profile/teams","hooks_url":"https://api.github.com/repos/mglaman/profile/hooks","issue_events_url":"https://api.github.com/repos/mglaman/profile/issues/events{/number}","events_url":"https://api.github.com/repos/mglaman/profile/events","assignees_url":"https://api.github.com/repos/mglaman/profile/assignees{/user}","branches_url":"https://api.github.com/repos/mglaman/profile/branches{/branch}","tags_url":"https://api.github.com/repos/mglaman/profile/tags","blobs_url":"https://api.github.com/repos/mglaman/profile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mglaman/profile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mglaman/profile/git/refs{/sha}","trees_url":"https://api.github.com/repos/mglaman/profile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mglaman/profile/statuses/{sha}","languages_url":"https://api.github.com/repos/mglaman/profile/languages","stargazers_url":"https://api.github.com/repos/mglaman/profile/stargazers","contributors_url":"https://api.github.com/repos/mglaman/profile/contributors","subscribers_url":"https://api.github.com/repos/mglaman/profile/subscribers","subscription_url":"https://api.github.com/repos/mglaman/profile/subscription","commits_url":"https://api.github.com/repos/mglaman/profile/commits{/sha}","git_commits_url":"https://api.github.com/repos/mglaman/profile/git/commits{/sha}","comments_url":"https://api.github.com/repos/mglaman/profile/comments{/number}","issue_comment_url":"https://api.github.com/repos/mglaman/profile/issues/comments{/number}","contents_url":"https://api.github.com/repos/mglaman/profile/contents/{+path}","compare_url":"https://api.github.com/repos/mglaman/profile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mglaman/profile/merges","archive_url":"https://api.github.com/repos/mglaman/profile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mglaman/profile/downloads","issues_url":"https://api.github.com/repos/mglaman/profile/issues{/number}","pulls_url":"https://api.github.com/repos/mglaman/profile/pulls{/number}","milestones_url":"https://api.github.com/repos/mglaman/profile/milestones{/number}","notifications_url":"https://api.github.com/repos/mglaman/profile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mglaman/profile/labels{/name}","releases_url":"https://api.github.com/repos/mglaman/profile/releases{/id}","created_at":"2015-11-17T14:11:59Z","updated_at":"2015-11-17T14:12:00Z","pushed_at":"2015-12-07T22:12:28Z","git_url":"git://github.com/mglaman/profile.git","ssh_url":"git@github.com:mglaman/profile.git","clone_url":"https://github.com/mglaman/profile.git","svn_url":"https://github.com/mglaman/profile","homepage":null,"size":377,"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":"bojanz:8.x-1.x","ref":"8.x-1.x","sha":"9d7e50588ff8771ec9c2e35f3ba0cc17a30bba3f","user":{"login":"bojanz","id":330162,"avatar_url":"https://avatars.githubusercontent.com/u/330162?v=3","gravatar_id":"","url":"https://api.github.com/users/bojanz","html_url":"https://github.com/bojanz","followers_url":"https://api.github.com/users/bojanz/followers","following_url":"https://api.github.com/users/bojanz/following{/other_user}","gists_url":"https://api.github.com/users/bojanz/gists{/gist_id}","starred_url":"https://api.github.com/users/bojanz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bojanz/subscriptions","organizations_url":"https://api.github.com/users/bojanz/orgs","repos_url":"https://api.github.com/users/bojanz/repos","events_url":"https://api.github.com/users/bojanz/events{/privacy}","received_events_url":"https://api.github.com/users/bojanz/received_events","type":"User","site_admin":false},"repo":{"id":45211304,"name":"profile","full_name":"bojanz/profile","owner":{"login":"bojanz","id":330162,"avatar_url":"https://avatars.githubusercontent.com/u/330162?v=3","gravatar_id":"","url":"https://api.github.com/users/bojanz","html_url":"https://github.com/bojanz","followers_url":"https://api.github.com/users/bojanz/followers","following_url":"https://api.github.com/users/bojanz/following{/other_user}","gists_url":"https://api.github.com/users/bojanz/gists{/gist_id}","starred_url":"https://api.github.com/users/bojanz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bojanz/subscriptions","organizations_url":"https://api.github.com/users/bojanz/orgs","repos_url":"https://api.github.com/users/bojanz/repos","events_url":"https://api.github.com/users/bojanz/events{/privacy}","received_events_url":"https://api.github.com/users/bojanz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bojanz/profile","description":"The GitHub mirror of the d.o profile project. PRs welcome.","fork":false,"url":"https://api.github.com/repos/bojanz/profile","forks_url":"https://api.github.com/repos/bojanz/profile/forks","keys_url":"https://api.github.com/repos/bojanz/profile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bojanz/profile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bojanz/profile/teams","hooks_url":"https://api.github.com/repos/bojanz/profile/hooks","issue_events_url":"https://api.github.com/repos/bojanz/profile/issues/events{/number}","events_url":"https://api.github.com/repos/bojanz/profile/events","assignees_url":"https://api.github.com/repos/bojanz/profile/assignees{/user}","branches_url":"https://api.github.com/repos/bojanz/profile/branches{/branch}","tags_url":"https://api.github.com/repos/bojanz/profile/tags","blobs_url":"https://api.github.com/repos/bojanz/profile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bojanz/profile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bojanz/profile/git/refs{/sha}","trees_url":"https://api.github.com/repos/bojanz/profile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bojanz/profile/statuses/{sha}","languages_url":"https://api.github.com/repos/bojanz/profile/languages","stargazers_url":"https://api.github.com/repos/bojanz/profile/stargazers","contributors_url":"https://api.github.com/repos/bojanz/profile/contributors","subscribers_url":"https://api.github.com/repos/bojanz/profile/subscribers","subscription_url":"https://api.github.com/repos/bojanz/profile/subscription","commits_url":"https://api.github.com/repos/bojanz/profile/commits{/sha}","git_commits_url":"https://api.github.com/repos/bojanz/profile/git/commits{/sha}","comments_url":"https://api.github.com/repos/bojanz/profile/comments{/number}","issue_comment_url":"https://api.github.com/repos/bojanz/profile/issues/comments{/number}","contents_url":"https://api.github.com/repos/bojanz/profile/contents/{+path}","compare_url":"https://api.github.com/repos/bojanz/profile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bojanz/profile/merges","archive_url":"https://api.github.com/repos/bojanz/profile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bojanz/profile/downloads","issues_url":"https://api.github.com/repos/bojanz/profile/issues{/number}","pulls_url":"https://api.github.com/repos/bojanz/profile/pulls{/number}","milestones_url":"https://api.github.com/repos/bojanz/profile/milestones{/number}","notifications_url":"https://api.github.com/repos/bojanz/profile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bojanz/profile/labels{/name}","releases_url":"https://api.github.com/repos/bojanz/profile/releases{/id}","created_at":"2015-10-29T21:21:14Z","updated_at":"2015-10-29T21:21:41Z","pushed_at":"2015-12-07T22:12:29Z","git_url":"git://github.com/bojanz/profile.git","ssh_url":"git@github.com:bojanz/profile.git","clone_url":"https://github.com/bojanz/profile.git","svn_url":"https://github.com/bojanz/profile","homepage":null,"size":370,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":0,"default_branch":"8.x-1.x"}},"_links":{"self":{"href":"https://api.github.com/repos/bojanz/profile/pulls/22"},"html":{"href":"https://github.com/bojanz/profile/pull/22"},"issue":{"href":"https://api.github.com/repos/bojanz/profile/issues/22"},"comments":{"href":"https://api.github.com/repos/bojanz/profile/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/bojanz/profile/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/bojanz/profile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bojanz/profile/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/bojanz/profile/statuses/d81eb8a3d5adc8f303471c7aa8440ef41e6a5f86"}}}}