{"action":"created","comment":{"url":"https://api.github.com/repos/ding2/ding2/pulls/comments/209893520","pull_request_review_id":145992527,"id":209893520,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTg5MzUyMA==","diff_hunk":"@@ -432,39 +433,202 @@ function ting_field_search_ting_search_settings_submit($form, &$form_state) {\n }\n \n /**\n- * Implements hook_form_FORM_ID_alter().\n+ * Implements hook_preprocess_html().\n+ *\n+ * Enable the search box to be expanded based on the path of the profiles.\n  */\n-function ting_field_search_form_search_block_form_alter(&$form, &$form_state) {\n-  if (!variable_get('ting_field_search_search_style', FALSE)) {\n-    return;\n+function ting_field_search_preprocess_html(&$vars) {\n+  $profiles = ting_field_search_profiles_load_all();\n+\n+  foreach ($profiles as $profile) {\n+    // Expended search box not checked go to the next profile.\n+    if (!array_key_exists('search_box', $profile->config['user_interaction']) || !$profile->config['user_interaction']['search_box']) {\n+      continue;\n+    }\n+\n+    // If the profile has visibility all always expand the search field.\n+    if ($profile->config['user_interaction']['visibility'] === 'all') {\n+      $vars['classes_array'][] = 'extended-search-is-open';\n+      break;\n+    }\n+\n+    $visibility = $profile->config['user_interaction']['visibility'] == 'expect' ? 0 : 1;\n+    $pages = $profile->config['user_interaction']['pages'];\n+    $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));\n+\n+    // We have an optimization hack to speed up search (by-pass panels 2x\n+    // times loading). So all searches are submitted to \"/search-blank\",\n+    // which need to be added to pages to ensure no form validation errors.\n+    // If visibility is \"expect\" it should not be added to the pages list.\n+    if ($visibility) {\n+      $pages .= \"\\r\\nsearch-blank\";\n+    }\n+\n+    // Compare the lowercase internal and lowercase path alias (if any).\n+    $page_match = drupal_match_path($path, $pages);\n+    if ($path != $_GET['q']) {\n+      $page_match = $page_match || drupal_match_path($_GET['q'], $pages);\n+    }\n+\n+    // When $visibility has a value of 0, the profile is displayed on\n+    // all pages except those listed in $pages. When set to 1, it\n+    // is displayed only on those pages listed in $pages.\n+    if (!($visibility xor $page_match)) {\n+      $vars['classes_array'][] = 'extended-search-is-open';\n+      break;\n+    }\n   }\n+}\n \n-  // Dont't alter the form if this is the node search page.\n-  if (strpos(current_path(), 'search/node') === 0) {\n-    return;\n+\n+/**\n+ * Find the default profile for the current context.\n+ *\n+ * @return string\n+ *   The name of the profile that is default.\n+ */\n+function ting_field_search_get_default_profile() {\n+  // If there's an active profile and it is stick; set it as default value.\n+  if ($default_profile = ting_field_search_get_active_profile()) {\n+    $default_profile = $default_profile->config['user_interaction']['sticky'] ? $default_profile->name : '';\n+  }\n+\n+  if (empty($default_profile)) {\n+    $profiles = ting_field_search_profiles_load_all();\n+    foreach ($profiles as $profile) {\n+      // Expended search box not checked go to the next profile.\n+      if (!array_key_exists('default_profile', $profile->config['user_interaction']) || !$profile->config['user_interaction']['default_profile']) {\n+        continue;\n+      }\n+\n+      // If the profile has visibility all always expand the search field.\n+      if ($profile->config['user_interaction']['visibility'] === 'all') {\n+        $default_profile = $profile->name;\n+        break;\n+      }\n+\n+      $visibility = $profile->config['user_interaction']['visibility'] == 'expect' ? 0 : 1;\n+      $pages = $profile->config['user_interaction']['pages'];\n+      $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));\n+\n+      // We have an optimization hack to speed up search (by-pass panels 2x\n+      // times loading). So all searches are submitted to \"/search-blank\",\n+      // which need to be added to pages to ensure no form validation errors.\n+      // If visibility is \"expect\" it should not be added to the pages list.\n+      if ($visibility) {\n+        $pages .= \"\\r\\nsearch-blank\";\n+      }\n+\n+      // Compare the lowercase internal and lowercase path alias (if any).\n+      $page_match = drupal_match_path($path, $pages);\n+      if ($path != $_GET['q']) {\n+        $page_match = $page_match || drupal_match_path($_GET['q'], $pages);\n+      }\n+\n+      // When $visibility has a value of 0, the profile is displayed on\n+      // all pages except those listed in $pages. When set to 1, it\n+      // is displayed only on those pages listed in $pages.\n+      if (!($visibility xor $page_match)) {\n+        $default_profile = $profile->name;","path":"modules/ting_field_search/ting_field_search.module","position":null,"original_position":148,"commit_id":"e8c06d14bc1eb22c2cac88eeef625e6a98f792b5","original_commit_id":"ab4becfa8a5584b64c2b914d891acfd4cff8f4af","user":{"login":"cableman","id":111397,"node_id":"MDQ6VXNlcjExMTM5Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/111397?v=4","gravatar_id":"","url":"https://api.github.com/users/cableman","html_url":"https://github.com/cableman","followers_url":"https://api.github.com/users/cableman/followers","following_url":"https://api.github.com/users/cableman/following{/other_user}","gists_url":"https://api.github.com/users/cableman/gists{/gist_id}","starred_url":"https://api.github.com/users/cableman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cableman/subscriptions","organizations_url":"https://api.github.com/users/cableman/orgs","repos_url":"https://api.github.com/users/cableman/repos","events_url":"https://api.github.com/users/cableman/events{/privacy}","received_events_url":"https://api.github.com/users/cableman/received_events","type":"User","site_admin":false},"body":"Changes accepted","created_at":"2018-08-14T09:55:04Z","updated_at":"2018-08-14T09:55:04Z","html_url":"https://github.com/ding2/ding2/pull/1019#discussion_r209893520","pull_request_url":"https://api.github.com/repos/ding2/ding2/pulls/1019","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ding2/ding2/pulls/comments/209893520"},"html":{"href":"https://github.com/ding2/ding2/pull/1019#discussion_r209893520"},"pull_request":{"href":"https://api.github.com/repos/ding2/ding2/pulls/1019"}},"in_reply_to_id":199163430},"pull_request":{"url":"https://api.github.com/repos/ding2/ding2/pulls/1019","id":170731167,"node_id":"MDExOlB1bGxSZXF1ZXN0MTcwNzMxMTY3","html_url":"https://github.com/ding2/ding2/pull/1019","diff_url":"https://github.com/ding2/ding2/pull/1019.diff","patch_url":"https://github.com/ding2/ding2/pull/1019.patch","issue_url":"https://api.github.com/repos/ding2/ding2/issues/1019","number":1019,"state":"open","locked":false,"title":"3236: Added search field profile filters","user":{"login":"cableman","id":111397,"node_id":"MDQ6VXNlcjExMTM5Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/111397?v=4","gravatar_id":"","url":"https://api.github.com/users/cableman","html_url":"https://github.com/cableman","followers_url":"https://api.github.com/users/cableman/followers","following_url":"https://api.github.com/users/cableman/following{/other_user}","gists_url":"https://api.github.com/users/cableman/gists{/gist_id}","starred_url":"https://api.github.com/users/cableman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cableman/subscriptions","organizations_url":"https://api.github.com/users/cableman/orgs","repos_url":"https://api.github.com/users/cableman/repos","events_url":"https://api.github.com/users/cableman/events{/privacy}","received_events_url":"https://api.github.com/users/cableman/received_events","type":"User","site_admin":false},"body":"Extension to field search to allow grouping of profiles and define which should be available on which pages.\r\n\r\nSee https://platform.dandigbib.org/issues/3236","created_at":"2018-02-22T12:00:46Z","updated_at":"2018-08-14T09:55:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1f96f7fbc5e6794b29731845d8dab7b061ab5bde","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ding2/ding2/pulls/1019/commits","review_comments_url":"https://api.github.com/repos/ding2/ding2/pulls/1019/comments","review_comment_url":"https://api.github.com/repos/ding2/ding2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ding2/ding2/issues/1019/comments","statuses_url":"https://api.github.com/repos/ding2/ding2/statuses/e8c06d14bc1eb22c2cac88eeef625e6a98f792b5","head":{"label":"aakbcms:feature/3236-search-profile-filters","ref":"feature/3236-search-profile-filters","sha":"e8c06d14bc1eb22c2cac88eeef625e6a98f792b5","user":{"login":"aakbcms","id":10941069,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwOTQxMDY5","avatar_url":"https://avatars3.githubusercontent.com/u/10941069?v=4","gravatar_id":"","url":"https://api.github.com/users/aakbcms","html_url":"https://github.com/aakbcms","followers_url":"https://api.github.com/users/aakbcms/followers","following_url":"https://api.github.com/users/aakbcms/following{/other_user}","gists_url":"https://api.github.com/users/aakbcms/gists{/gist_id}","starred_url":"https://api.github.com/users/aakbcms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aakbcms/subscriptions","organizations_url":"https://api.github.com/users/aakbcms/orgs","repos_url":"https://api.github.com/users/aakbcms/repos","events_url":"https://api.github.com/users/aakbcms/events{/privacy}","received_events_url":"https://api.github.com/users/aakbcms/received_events","type":"Organization","site_admin":false},"repo":{"id":49064130,"node_id":"MDEwOlJlcG9zaXRvcnk0OTA2NDEzMA==","name":"patches","full_name":"aakbcms/patches","owner":{"login":"aakbcms","id":10941069,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwOTQxMDY5","avatar_url":"https://avatars3.githubusercontent.com/u/10941069?v=4","gravatar_id":"","url":"https://api.github.com/users/aakbcms","html_url":"https://github.com/aakbcms","followers_url":"https://api.github.com/users/aakbcms/followers","following_url":"https://api.github.com/users/aakbcms/following{/other_user}","gists_url":"https://api.github.com/users/aakbcms/gists{/gist_id}","starred_url":"https://api.github.com/users/aakbcms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aakbcms/subscriptions","organizations_url":"https://api.github.com/users/aakbcms/orgs","repos_url":"https://api.github.com/users/aakbcms/repos","events_url":"https://api.github.com/users/aakbcms/events{/privacy}","received_events_url":"https://api.github.com/users/aakbcms/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aakbcms/patches","description":"Ding install profile","fork":true,"url":"https://api.github.com/repos/aakbcms/patches","forks_url":"https://api.github.com/repos/aakbcms/patches/forks","keys_url":"https://api.github.com/repos/aakbcms/patches/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aakbcms/patches/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aakbcms/patches/teams","hooks_url":"https://api.github.com/repos/aakbcms/patches/hooks","issue_events_url":"https://api.github.com/repos/aakbcms/patches/issues/events{/number}","events_url":"https://api.github.com/repos/aakbcms/patches/events","assignees_url":"https://api.github.com/repos/aakbcms/patches/assignees{/user}","branches_url":"https://api.github.com/repos/aakbcms/patches/branches{/branch}","tags_url":"https://api.github.com/repos/aakbcms/patches/tags","blobs_url":"https://api.github.com/repos/aakbcms/patches/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aakbcms/patches/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aakbcms/patches/git/refs{/sha}","trees_url":"https://api.github.com/repos/aakbcms/patches/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aakbcms/patches/statuses/{sha}","languages_url":"https://api.github.com/repos/aakbcms/patches/languages","stargazers_url":"https://api.github.com/repos/aakbcms/patches/stargazers","contributors_url":"https://api.github.com/repos/aakbcms/patches/contributors","subscribers_url":"https://api.github.com/repos/aakbcms/patches/subscribers","subscription_url":"https://api.github.com/repos/aakbcms/patches/subscription","commits_url":"https://api.github.com/repos/aakbcms/patches/commits{/sha}","git_commits_url":"https://api.github.com/repos/aakbcms/patches/git/commits{/sha}","comments_url":"https://api.github.com/repos/aakbcms/patches/comments{/number}","issue_comment_url":"https://api.github.com/repos/aakbcms/patches/issues/comments{/number}","contents_url":"https://api.github.com/repos/aakbcms/patches/contents/{+path}","compare_url":"https://api.github.com/repos/aakbcms/patches/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aakbcms/patches/merges","archive_url":"https://api.github.com/repos/aakbcms/patches/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aakbcms/patches/downloads","issues_url":"https://api.github.com/repos/aakbcms/patches/issues{/number}","pulls_url":"https://api.github.com/repos/aakbcms/patches/pulls{/number}","milestones_url":"https://api.github.com/repos/aakbcms/patches/milestones{/number}","notifications_url":"https://api.github.com/repos/aakbcms/patches/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aakbcms/patches/labels{/name}","releases_url":"https://api.github.com/repos/aakbcms/patches/releases{/id}","deployments_url":"https://api.github.com/repos/aakbcms/patches/deployments","created_at":"2016-01-05T12:21:32Z","updated_at":"2018-08-09T13:00:03Z","pushed_at":"2018-08-14T09:53:54Z","git_url":"git://github.com/aakbcms/patches.git","ssh_url":"git@github.com:aakbcms/patches.git","clone_url":"https://github.com/aakbcms/patches.git","svn_url":"https://github.com/aakbcms/patches","homepage":"","size":95289,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ding2:master","ref":"master","sha":"8c38619a544733c393ba10c8e8a8efa02f961ec7","user":{"login":"ding2","id":564698,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2NDY5OA==","avatar_url":"https://avatars0.githubusercontent.com/u/564698?v=4","gravatar_id":"","url":"https://api.github.com/users/ding2","html_url":"https://github.com/ding2","followers_url":"https://api.github.com/users/ding2/followers","following_url":"https://api.github.com/users/ding2/following{/other_user}","gists_url":"https://api.github.com/users/ding2/gists{/gist_id}","starred_url":"https://api.github.com/users/ding2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ding2/subscriptions","organizations_url":"https://api.github.com/users/ding2/orgs","repos_url":"https://api.github.com/users/ding2/repos","events_url":"https://api.github.com/users/ding2/events{/privacy}","received_events_url":"https://api.github.com/users/ding2/received_events","type":"Organization","site_admin":false},"repo":{"id":1266749,"node_id":"MDEwOlJlcG9zaXRvcnkxMjY2NzQ5","name":"ding2","full_name":"ding2/ding2","owner":{"login":"ding2","id":564698,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2NDY5OA==","avatar_url":"https://avatars0.githubusercontent.com/u/564698?v=4","gravatar_id":"","url":"https://api.github.com/users/ding2","html_url":"https://github.com/ding2","followers_url":"https://api.github.com/users/ding2/followers","following_url":"https://api.github.com/users/ding2/following{/other_user}","gists_url":"https://api.github.com/users/ding2/gists{/gist_id}","starred_url":"https://api.github.com/users/ding2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ding2/subscriptions","organizations_url":"https://api.github.com/users/ding2/orgs","repos_url":"https://api.github.com/users/ding2/repos","events_url":"https://api.github.com/users/ding2/events{/privacy}","received_events_url":"https://api.github.com/users/ding2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ding2/ding2","description":"Ding install profile","fork":false,"url":"https://api.github.com/repos/ding2/ding2","forks_url":"https://api.github.com/repos/ding2/ding2/forks","keys_url":"https://api.github.com/repos/ding2/ding2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ding2/ding2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ding2/ding2/teams","hooks_url":"https://api.github.com/repos/ding2/ding2/hooks","issue_events_url":"https://api.github.com/repos/ding2/ding2/issues/events{/number}","events_url":"https://api.github.com/repos/ding2/ding2/events","assignees_url":"https://api.github.com/repos/ding2/ding2/assignees{/user}","branches_url":"https://api.github.com/repos/ding2/ding2/branches{/branch}","tags_url":"https://api.github.com/repos/ding2/ding2/tags","blobs_url":"https://api.github.com/repos/ding2/ding2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ding2/ding2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ding2/ding2/git/refs{/sha}","trees_url":"https://api.github.com/repos/ding2/ding2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ding2/ding2/statuses/{sha}","languages_url":"https://api.github.com/repos/ding2/ding2/languages","stargazers_url":"https://api.github.com/repos/ding2/ding2/stargazers","contributors_url":"https://api.github.com/repos/ding2/ding2/contributors","subscribers_url":"https://api.github.com/repos/ding2/ding2/subscribers","subscription_url":"https://api.github.com/repos/ding2/ding2/subscription","commits_url":"https://api.github.com/repos/ding2/ding2/commits{/sha}","git_commits_url":"https://api.github.com/repos/ding2/ding2/git/commits{/sha}","comments_url":"https://api.github.com/repos/ding2/ding2/comments{/number}","issue_comment_url":"https://api.github.com/repos/ding2/ding2/issues/comments{/number}","contents_url":"https://api.github.com/repos/ding2/ding2/contents/{+path}","compare_url":"https://api.github.com/repos/ding2/ding2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ding2/ding2/merges","archive_url":"https://api.github.com/repos/ding2/ding2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ding2/ding2/downloads","issues_url":"https://api.github.com/repos/ding2/ding2/issues{/number}","pulls_url":"https://api.github.com/repos/ding2/ding2/pulls{/number}","milestones_url":"https://api.github.com/repos/ding2/ding2/milestones{/number}","notifications_url":"https://api.github.com/repos/ding2/ding2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ding2/ding2/labels{/name}","releases_url":"https://api.github.com/repos/ding2/ding2/releases{/id}","deployments_url":"https://api.github.com/repos/ding2/ding2/deployments","created_at":"2011-01-18T10:54:00Z","updated_at":"2018-08-14T07:01:53Z","pushed_at":"2018-08-14T09:53:56Z","git_url":"git://github.com/ding2/ding2.git","ssh_url":"git@github.com:ding2/ding2.git","clone_url":"https://github.com/ding2/ding2.git","svn_url":"https://github.com/ding2/ding2","homepage":"","size":95682,"stargazers_count":13,"watchers_count":13,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":46,"mirror_url":null,"archived":false,"open_issues_count":160,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":46,"open_issues":160,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ding2/ding2/pulls/1019"},"html":{"href":"https://github.com/ding2/ding2/pull/1019"},"issue":{"href":"https://api.github.com/repos/ding2/ding2/issues/1019"},"comments":{"href":"https://api.github.com/repos/ding2/ding2/issues/1019/comments"},"review_comments":{"href":"https://api.github.com/repos/ding2/ding2/pulls/1019/comments"},"review_comment":{"href":"https://api.github.com/repos/ding2/ding2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ding2/ding2/pulls/1019/commits"},"statuses":{"href":"https://api.github.com/repos/ding2/ding2/statuses/e8c06d14bc1eb22c2cac88eeef625e6a98f792b5"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"cableman"}}