{"action":"created","comment":{"url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/comments/106386936","pull_request_review_id":27304699,"id":106386936,"diff_hunk":"@@ -30,6 +31,98 @@ function collection_form_block_form_alter(&$form, FormStateInterface $form_state\n }\n \n /**\n+ * Implements hook_form_BASE_FORM_ID_alter().\n+ *\n+ * Alters the RDF entity form for Collections:\n+ * - Changes the available options for the eLibrary creation field depending on\n+ *   whether a collection is closed or open:\n+ *   - Open collection: eLibrary content can be created either only by\n+ *     collection facilitators, or by all registered users.\n+ *   - Closed collection: eLibrary content can be created either only by\n+ *     collection facilitators, or by members of the collection.\n+ *   When the collection changes between closed and open we will use AJAX to\n+ *   update the eLibrary creation field to contain the correct options.\n+ */\n+function collection_form_rdf_entity_form_alter(&$form, FormStateInterface $form_state, $form_id) {\n+  // Only alter collection forms.\n+  if ($form_state->getFormObject()->getEntity()->bundle() !== 'collection') {\n+    return;\n+  }\n+\n+  // Retrieve the entity from the form.\n+  $entity = $form_state->getFormObject()->getEntity();\n+\n+  // Get the current values for the 'Closed collection' and 'eLibrary creation'\n+  // fields. If the form has not yet been submitted, use the defaults from the\n+  // loaded or newly created entity.\n+  $closed = $form_state->isValueEmpty('field_ar_closed') ? $entity->field_ar_closed->value : $form_state->getValue('field_ar_closed')['value'];\n+  $elibrary = !$form_state->isProcessingInput() ? $entity->field_ar_elibrary_creation->value : (int) $form_state->getUserInput()['field_ar_elibrary_creation'];\n+\n+  // Define the allowed options.\n+  $allowed_options = [\n+    // In open collections content can be made by members (option 1) and\n+    // authenticated users (option 2).\n+    0 => [1 => 1, 2 => 2],","path":"web/modules/custom/collection/collection.module","position":null,"original_position":43,"commit_id":"99bdf7aa24bc89a0cfa7d8f2af2b4d2d5a30fd93","original_commit_id":"1f2981a20e2f89320017b2390038f1f28bd63ccb","user":{"login":"pfrenssen","id":442924,"avatar_url":"https://avatars3.githubusercontent.com/u/442924?v=3","gravatar_id":"","url":"https://api.github.com/users/pfrenssen","html_url":"https://github.com/pfrenssen","followers_url":"https://api.github.com/users/pfrenssen/followers","following_url":"https://api.github.com/users/pfrenssen/following{/other_user}","gists_url":"https://api.github.com/users/pfrenssen/gists{/gist_id}","starred_url":"https://api.github.com/users/pfrenssen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfrenssen/subscriptions","organizations_url":"https://api.github.com/users/pfrenssen/orgs","repos_url":"https://api.github.com/users/pfrenssen/repos","events_url":"https://api.github.com/users/pfrenssen/events{/privacy}","received_events_url":"https://api.github.com/users/pfrenssen/received_events","type":"User","site_admin":false},"body":"Sure thing pal! I put them in a final class that extends `SplEnum` :)","created_at":"2017-03-16T10:48:45Z","updated_at":"2017-03-16T10:48:45Z","html_url":"https://github.com/ec-europa/joinup-dev/pull/406#discussion_r106386936","pull_request_url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/406","_links":{"self":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/comments/106386936"},"html":{"href":"https://github.com/ec-europa/joinup-dev/pull/406#discussion_r106386936"},"pull_request":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/406"}}},"pull_request":{"url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/406","id":109314462,"html_url":"https://github.com/ec-europa/joinup-dev/pull/406","diff_url":"https://github.com/ec-europa/joinup-dev/pull/406.diff","patch_url":"https://github.com/ec-europa/joinup-dev/pull/406.patch","issue_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues/406","number":406,"state":"open","locked":false,"title":"ISAICP-3200: Make sure the JS behaviour for the eLibrary slider is on……ly attached once.","user":{"login":"pfrenssen","id":442924,"avatar_url":"https://avatars3.githubusercontent.com/u/442924?v=3","gravatar_id":"","url":"https://api.github.com/users/pfrenssen","html_url":"https://github.com/pfrenssen","followers_url":"https://api.github.com/users/pfrenssen/followers","following_url":"https://api.github.com/users/pfrenssen/following{/other_user}","gists_url":"https://api.github.com/users/pfrenssen/gists{/gist_id}","starred_url":"https://api.github.com/users/pfrenssen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfrenssen/subscriptions","organizations_url":"https://api.github.com/users/pfrenssen/orgs","repos_url":"https://api.github.com/users/pfrenssen/repos","events_url":"https://api.github.com/users/pfrenssen/events{/privacy}","received_events_url":"https://api.github.com/users/pfrenssen/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-03-06T18:00:55Z","updated_at":"2017-03-16T10:48:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b171c2e1006502cace28498696833127d04756c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/406/commits","review_comments_url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/406/comments","review_comment_url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues/406/comments","statuses_url":"https://api.github.com/repos/ec-europa/joinup-dev/statuses/99bdf7aa24bc89a0cfa7d8f2af2b4d2d5a30fd93","head":{"label":"ec-europa:ISAICP-3200","ref":"ISAICP-3200","sha":"99bdf7aa24bc89a0cfa7d8f2af2b4d2d5a30fd93","user":{"login":"ec-europa","id":10885565,"avatar_url":"https://avatars2.githubusercontent.com/u/10885565?v=3","gravatar_id":"","url":"https://api.github.com/users/ec-europa","html_url":"https://github.com/ec-europa","followers_url":"https://api.github.com/users/ec-europa/followers","following_url":"https://api.github.com/users/ec-europa/following{/other_user}","gists_url":"https://api.github.com/users/ec-europa/gists{/gist_id}","starred_url":"https://api.github.com/users/ec-europa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ec-europa/subscriptions","organizations_url":"https://api.github.com/users/ec-europa/orgs","repos_url":"https://api.github.com/users/ec-europa/repos","events_url":"https://api.github.com/users/ec-europa/events{/privacy}","received_events_url":"https://api.github.com/users/ec-europa/received_events","type":"Organization","site_admin":false},"repo":{"id":46046597,"name":"joinup-dev","full_name":"ec-europa/joinup-dev","owner":{"login":"ec-europa","id":10885565,"avatar_url":"https://avatars2.githubusercontent.com/u/10885565?v=3","gravatar_id":"","url":"https://api.github.com/users/ec-europa","html_url":"https://github.com/ec-europa","followers_url":"https://api.github.com/users/ec-europa/followers","following_url":"https://api.github.com/users/ec-europa/following{/other_user}","gists_url":"https://api.github.com/users/ec-europa/gists{/gist_id}","starred_url":"https://api.github.com/users/ec-europa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ec-europa/subscriptions","organizations_url":"https://api.github.com/users/ec-europa/orgs","repos_url":"https://api.github.com/users/ec-europa/repos","events_url":"https://api.github.com/users/ec-europa/events{/privacy}","received_events_url":"https://api.github.com/users/ec-europa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ec-europa/joinup-dev","description":"Joinup Drupal 8 development","fork":false,"url":"https://api.github.com/repos/ec-europa/joinup-dev","forks_url":"https://api.github.com/repos/ec-europa/joinup-dev/forks","keys_url":"https://api.github.com/repos/ec-europa/joinup-dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ec-europa/joinup-dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ec-europa/joinup-dev/teams","hooks_url":"https://api.github.com/repos/ec-europa/joinup-dev/hooks","issue_events_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues/events{/number}","events_url":"https://api.github.com/repos/ec-europa/joinup-dev/events","assignees_url":"https://api.github.com/repos/ec-europa/joinup-dev/assignees{/user}","branches_url":"https://api.github.com/repos/ec-europa/joinup-dev/branches{/branch}","tags_url":"https://api.github.com/repos/ec-europa/joinup-dev/tags","blobs_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ec-europa/joinup-dev/statuses/{sha}","languages_url":"https://api.github.com/repos/ec-europa/joinup-dev/languages","stargazers_url":"https://api.github.com/repos/ec-europa/joinup-dev/stargazers","contributors_url":"https://api.github.com/repos/ec-europa/joinup-dev/contributors","subscribers_url":"https://api.github.com/repos/ec-europa/joinup-dev/subscribers","subscription_url":"https://api.github.com/repos/ec-europa/joinup-dev/subscription","commits_url":"https://api.github.com/repos/ec-europa/joinup-dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/ec-europa/joinup-dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/ec-europa/joinup-dev/contents/{+path}","compare_url":"https://api.github.com/repos/ec-europa/joinup-dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ec-europa/joinup-dev/merges","archive_url":"https://api.github.com/repos/ec-europa/joinup-dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ec-europa/joinup-dev/downloads","issues_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues{/number}","pulls_url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls{/number}","milestones_url":"https://api.github.com/repos/ec-europa/joinup-dev/milestones{/number}","notifications_url":"https://api.github.com/repos/ec-europa/joinup-dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ec-europa/joinup-dev/labels{/name}","releases_url":"https://api.github.com/repos/ec-europa/joinup-dev/releases{/id}","deployments_url":"https://api.github.com/repos/ec-europa/joinup-dev/deployments","created_at":"2015-11-12T10:46:34Z","updated_at":"2017-03-10T08:58:43Z","pushed_at":"2017-03-16T10:47:52Z","git_url":"git://github.com/ec-europa/joinup-dev.git","ssh_url":"git@github.com:ec-europa/joinup-dev.git","clone_url":"https://github.com/ec-europa/joinup-dev.git","svn_url":"https://github.com/ec-europa/joinup-dev","homepage":null,"size":41714,"stargazers_count":11,"watchers_count":11,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6,"mirror_url":null,"open_issues_count":25,"forks":6,"open_issues":25,"watchers":11,"default_branch":"develop"}},"base":{"label":"ec-europa:develop","ref":"develop","sha":"be3e8c0594bde969344c009933850c31474b7044","user":{"login":"ec-europa","id":10885565,"avatar_url":"https://avatars2.githubusercontent.com/u/10885565?v=3","gravatar_id":"","url":"https://api.github.com/users/ec-europa","html_url":"https://github.com/ec-europa","followers_url":"https://api.github.com/users/ec-europa/followers","following_url":"https://api.github.com/users/ec-europa/following{/other_user}","gists_url":"https://api.github.com/users/ec-europa/gists{/gist_id}","starred_url":"https://api.github.com/users/ec-europa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ec-europa/subscriptions","organizations_url":"https://api.github.com/users/ec-europa/orgs","repos_url":"https://api.github.com/users/ec-europa/repos","events_url":"https://api.github.com/users/ec-europa/events{/privacy}","received_events_url":"https://api.github.com/users/ec-europa/received_events","type":"Organization","site_admin":false},"repo":{"id":46046597,"name":"joinup-dev","full_name":"ec-europa/joinup-dev","owner":{"login":"ec-europa","id":10885565,"avatar_url":"https://avatars2.githubusercontent.com/u/10885565?v=3","gravatar_id":"","url":"https://api.github.com/users/ec-europa","html_url":"https://github.com/ec-europa","followers_url":"https://api.github.com/users/ec-europa/followers","following_url":"https://api.github.com/users/ec-europa/following{/other_user}","gists_url":"https://api.github.com/users/ec-europa/gists{/gist_id}","starred_url":"https://api.github.com/users/ec-europa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ec-europa/subscriptions","organizations_url":"https://api.github.com/users/ec-europa/orgs","repos_url":"https://api.github.com/users/ec-europa/repos","events_url":"https://api.github.com/users/ec-europa/events{/privacy}","received_events_url":"https://api.github.com/users/ec-europa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ec-europa/joinup-dev","description":"Joinup Drupal 8 development","fork":false,"url":"https://api.github.com/repos/ec-europa/joinup-dev","forks_url":"https://api.github.com/repos/ec-europa/joinup-dev/forks","keys_url":"https://api.github.com/repos/ec-europa/joinup-dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ec-europa/joinup-dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ec-europa/joinup-dev/teams","hooks_url":"https://api.github.com/repos/ec-europa/joinup-dev/hooks","issue_events_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues/events{/number}","events_url":"https://api.github.com/repos/ec-europa/joinup-dev/events","assignees_url":"https://api.github.com/repos/ec-europa/joinup-dev/assignees{/user}","branches_url":"https://api.github.com/repos/ec-europa/joinup-dev/branches{/branch}","tags_url":"https://api.github.com/repos/ec-europa/joinup-dev/tags","blobs_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ec-europa/joinup-dev/statuses/{sha}","languages_url":"https://api.github.com/repos/ec-europa/joinup-dev/languages","stargazers_url":"https://api.github.com/repos/ec-europa/joinup-dev/stargazers","contributors_url":"https://api.github.com/repos/ec-europa/joinup-dev/contributors","subscribers_url":"https://api.github.com/repos/ec-europa/joinup-dev/subscribers","subscription_url":"https://api.github.com/repos/ec-europa/joinup-dev/subscription","commits_url":"https://api.github.com/repos/ec-europa/joinup-dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/ec-europa/joinup-dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/ec-europa/joinup-dev/contents/{+path}","compare_url":"https://api.github.com/repos/ec-europa/joinup-dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ec-europa/joinup-dev/merges","archive_url":"https://api.github.com/repos/ec-europa/joinup-dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ec-europa/joinup-dev/downloads","issues_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues{/number}","pulls_url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls{/number}","milestones_url":"https://api.github.com/repos/ec-europa/joinup-dev/milestones{/number}","notifications_url":"https://api.github.com/repos/ec-europa/joinup-dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ec-europa/joinup-dev/labels{/name}","releases_url":"https://api.github.com/repos/ec-europa/joinup-dev/releases{/id}","deployments_url":"https://api.github.com/repos/ec-europa/joinup-dev/deployments","created_at":"2015-11-12T10:46:34Z","updated_at":"2017-03-10T08:58:43Z","pushed_at":"2017-03-16T10:47:52Z","git_url":"git://github.com/ec-europa/joinup-dev.git","ssh_url":"git@github.com:ec-europa/joinup-dev.git","clone_url":"https://github.com/ec-europa/joinup-dev.git","svn_url":"https://github.com/ec-europa/joinup-dev","homepage":null,"size":41714,"stargazers_count":11,"watchers_count":11,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6,"mirror_url":null,"open_issues_count":25,"forks":6,"open_issues":25,"watchers":11,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/406"},"html":{"href":"https://github.com/ec-europa/joinup-dev/pull/406"},"issue":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/issues/406"},"comments":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/issues/406/comments"},"review_comments":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/406/comments"},"review_comment":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/406/commits"},"statuses":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/statuses/99bdf7aa24bc89a0cfa7d8f2af2b4d2d5a30fd93"}}}}
{"actor":{"display_login":"pfrenssen"}}