{"action":"created","comment":{"url":"https://api.github.com/repos/tag1consulting/support/pulls/comments/38539136","id":38539136,"diff_hunk":"@@ -266,6 +266,77 @@ function support_ticket_load($nid = NULL, $reset = FALSE) {\n }\n \n /**\n+ * Determines what fields have changed when the support ticket is updated.\n+ *\n+ * @param object $support_ticket\n+ *   The support ticket entity object.\n+ */\n+function support_ticket_entity_update($support_ticket) {\n+  if (!method_exists($support_ticket, 'getFields')) {\n+    return;\n+  }\n+\n+  $fields = $support_ticket->getFields();\n+  $langcodes = array_keys($support_ticket->getTranslationLanguages());\n+  $original = !empty($support_ticket->original) ? $support_ticket->original: NULL;\n+\n+  // Don't log changes to the following fields when the support_ticket is updated.\n+  // @todo: What's the cleanest way to expose this and make it configurable?\n+  $ignore = array(\n+    'field' => array('stid', 'uuid', 'vid', 'langcode', 'changed', 'revision_timestamp', 'revision_uid', 'revision_log', 'revision_translation_affected'),\n+    'type' => array('comment'),\n+  );\n+  $items = array();\n+  foreach ($fields as $name => $field) {\n+    $type = $field->getFieldDefinition()->getType();\n+    if (!in_array($name, $ignore['field']) && !in_array($type, $ignore['type'])) {\n+      foreach ($langcodes as $langcode) {\n+        $compare = $support_ticket->getTranslation($langcode)->get($name)->filterEmptyItems();\n+        $compare_original = $original->getTranslation($langcode)->get($name)->filterEmptyItems();\n+        if (!$compare->equals($compare_original)) {\n+          $markup = array();","path":"modules/support_ticket/support_ticket.module","position":32,"original_position":32,"commit_id":"bc97389903990e59e3cff6bced51bcea85702d38","original_commit_id":"bc97389903990e59e3cff6bced51bcea85702d38","user":{"login":"catch56","id":116285,"avatar_url":"https://avatars.githubusercontent.com/u/116285?v=3","gravatar_id":"","url":"https://api.github.com/users/catch56","html_url":"https://github.com/catch56","followers_url":"https://api.github.com/users/catch56/followers","following_url":"https://api.github.com/users/catch56/following{/other_user}","gists_url":"https://api.github.com/users/catch56/gists{/gist_id}","starred_url":"https://api.github.com/users/catch56/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/catch56/subscriptions","organizations_url":"https://api.github.com/users/catch56/orgs","repos_url":"https://api.github.com/users/catch56/repos","events_url":"https://api.github.com/users/catch56/events{/privacy}","received_events_url":"https://api.github.com/users/catch56/received_events","type":"User","site_admin":false},"body":"Could probably use https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21EntityViewBuilder.php/function/EntityViewBuilder%3A%3AviewFieldItem/8\r\n\r\n(or viewField)\r\n\r\nAnd then specify custom display settings as opposed to a view mode to ensure the label is always kept.","created_at":"2015-09-02T14:38:21Z","updated_at":"2015-09-02T14:38:21Z","html_url":"https://github.com/tag1consulting/support/pull/9#discussion_r38539136","pull_request_url":"https://api.github.com/repos/tag1consulting/support/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/tag1consulting/support/pulls/comments/38539136"},"html":{"href":"https://github.com/tag1consulting/support/pull/9#discussion_r38539136"},"pull_request":{"href":"https://api.github.com/repos/tag1consulting/support/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/tag1consulting/support/pulls/9","id":43765434,"html_url":"https://github.com/tag1consulting/support/pull/9","diff_url":"https://github.com/tag1consulting/support/pull/9.diff","patch_url":"https://github.com/tag1consulting/support/pull/9.patch","issue_url":"https://api.github.com/repos/tag1consulting/support/issues/9","number":9,"state":"open","locked":false,"title":"use hook_entity_update to log metadata updates","user":{"login":"jeremyandrews","id":402892,"avatar_url":"https://avatars.githubusercontent.com/u/402892?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremyandrews","html_url":"https://github.com/jeremyandrews","followers_url":"https://api.github.com/users/jeremyandrews/followers","following_url":"https://api.github.com/users/jeremyandrews/following{/other_user}","gists_url":"https://api.github.com/users/jeremyandrews/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyandrews/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyandrews/subscriptions","organizations_url":"https://api.github.com/users/jeremyandrews/orgs","repos_url":"https://api.github.com/users/jeremyandrews/repos","events_url":"https://api.github.com/users/jeremyandrews/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyandrews/received_events","type":"User","site_admin":false},"body":"This is a first attempt at logging metadata changes (state, priority, title, etc) into a comment as architected in https://support.tag1consulting.com/node/156952 -- I do not think it should be merged as is, instead I'm looking for guidance on the cleanest way to implement this in D8, and whether or not this is what you had in mind.","created_at":"2015-08-31T13:43:28Z","updated_at":"2015-09-02T14:38:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"496b11f1d7f1ac240ad699ecc17654d67626d037","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tag1consulting/support/pulls/9/commits","review_comments_url":"https://api.github.com/repos/tag1consulting/support/pulls/9/comments","review_comment_url":"https://api.github.com/repos/tag1consulting/support/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tag1consulting/support/issues/9/comments","statuses_url":"https://api.github.com/repos/tag1consulting/support/statuses/bc97389903990e59e3cff6bced51bcea85702d38","head":{"label":"jeremyandrews:revision-comment","ref":"revision-comment","sha":"bc97389903990e59e3cff6bced51bcea85702d38","user":{"login":"jeremyandrews","id":402892,"avatar_url":"https://avatars.githubusercontent.com/u/402892?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremyandrews","html_url":"https://github.com/jeremyandrews","followers_url":"https://api.github.com/users/jeremyandrews/followers","following_url":"https://api.github.com/users/jeremyandrews/following{/other_user}","gists_url":"https://api.github.com/users/jeremyandrews/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyandrews/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyandrews/subscriptions","organizations_url":"https://api.github.com/users/jeremyandrews/orgs","repos_url":"https://api.github.com/users/jeremyandrews/repos","events_url":"https://api.github.com/users/jeremyandrews/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyandrews/received_events","type":"User","site_admin":false},"repo":{"id":39882046,"name":"support","full_name":"jeremyandrews/support","owner":{"login":"jeremyandrews","id":402892,"avatar_url":"https://avatars.githubusercontent.com/u/402892?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremyandrews","html_url":"https://github.com/jeremyandrews","followers_url":"https://api.github.com/users/jeremyandrews/followers","following_url":"https://api.github.com/users/jeremyandrews/following{/other_user}","gists_url":"https://api.github.com/users/jeremyandrews/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyandrews/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyandrews/subscriptions","organizations_url":"https://api.github.com/users/jeremyandrews/orgs","repos_url":"https://api.github.com/users/jeremyandrews/repos","events_url":"https://api.github.com/users/jeremyandrews/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyandrews/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeremyandrews/support","description":"8.x-1.x Drupal support module development","fork":true,"url":"https://api.github.com/repos/jeremyandrews/support","forks_url":"https://api.github.com/repos/jeremyandrews/support/forks","keys_url":"https://api.github.com/repos/jeremyandrews/support/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeremyandrews/support/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeremyandrews/support/teams","hooks_url":"https://api.github.com/repos/jeremyandrews/support/hooks","issue_events_url":"https://api.github.com/repos/jeremyandrews/support/issues/events{/number}","events_url":"https://api.github.com/repos/jeremyandrews/support/events","assignees_url":"https://api.github.com/repos/jeremyandrews/support/assignees{/user}","branches_url":"https://api.github.com/repos/jeremyandrews/support/branches{/branch}","tags_url":"https://api.github.com/repos/jeremyandrews/support/tags","blobs_url":"https://api.github.com/repos/jeremyandrews/support/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeremyandrews/support/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeremyandrews/support/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeremyandrews/support/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeremyandrews/support/statuses/{sha}","languages_url":"https://api.github.com/repos/jeremyandrews/support/languages","stargazers_url":"https://api.github.com/repos/jeremyandrews/support/stargazers","contributors_url":"https://api.github.com/repos/jeremyandrews/support/contributors","subscribers_url":"https://api.github.com/repos/jeremyandrews/support/subscribers","subscription_url":"https://api.github.com/repos/jeremyandrews/support/subscription","commits_url":"https://api.github.com/repos/jeremyandrews/support/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeremyandrews/support/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeremyandrews/support/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeremyandrews/support/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeremyandrews/support/contents/{+path}","compare_url":"https://api.github.com/repos/jeremyandrews/support/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeremyandrews/support/merges","archive_url":"https://api.github.com/repos/jeremyandrews/support/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeremyandrews/support/downloads","issues_url":"https://api.github.com/repos/jeremyandrews/support/issues{/number}","pulls_url":"https://api.github.com/repos/jeremyandrews/support/pulls{/number}","milestones_url":"https://api.github.com/repos/jeremyandrews/support/milestones{/number}","notifications_url":"https://api.github.com/repos/jeremyandrews/support/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeremyandrews/support/labels{/name}","releases_url":"https://api.github.com/repos/jeremyandrews/support/releases{/id}","created_at":"2015-07-29T08:20:57Z","updated_at":"2015-07-29T10:05:36Z","pushed_at":"2015-09-02T14:29:28Z","git_url":"git://github.com/jeremyandrews/support.git","ssh_url":"git@github.com:jeremyandrews/support.git","clone_url":"https://github.com/jeremyandrews/support.git","svn_url":"https://github.com/jeremyandrews/support","homepage":null,"size":1004,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"8.x-1.x"}},"base":{"label":"tag1consulting:8.x-1.x","ref":"8.x-1.x","sha":"21171e30da38e3cd50fdde9259e3086e4594fa9b","user":{"login":"tag1consulting","id":386763,"avatar_url":"https://avatars.githubusercontent.com/u/386763?v=3","gravatar_id":"","url":"https://api.github.com/users/tag1consulting","html_url":"https://github.com/tag1consulting","followers_url":"https://api.github.com/users/tag1consulting/followers","following_url":"https://api.github.com/users/tag1consulting/following{/other_user}","gists_url":"https://api.github.com/users/tag1consulting/gists{/gist_id}","starred_url":"https://api.github.com/users/tag1consulting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tag1consulting/subscriptions","organizations_url":"https://api.github.com/users/tag1consulting/orgs","repos_url":"https://api.github.com/users/tag1consulting/repos","events_url":"https://api.github.com/users/tag1consulting/events{/privacy}","received_events_url":"https://api.github.com/users/tag1consulting/received_events","type":"Organization","site_admin":false},"repo":{"id":39879074,"name":"support","full_name":"tag1consulting/support","owner":{"login":"tag1consulting","id":386763,"avatar_url":"https://avatars.githubusercontent.com/u/386763?v=3","gravatar_id":"","url":"https://api.github.com/users/tag1consulting","html_url":"https://github.com/tag1consulting","followers_url":"https://api.github.com/users/tag1consulting/followers","following_url":"https://api.github.com/users/tag1consulting/following{/other_user}","gists_url":"https://api.github.com/users/tag1consulting/gists{/gist_id}","starred_url":"https://api.github.com/users/tag1consulting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tag1consulting/subscriptions","organizations_url":"https://api.github.com/users/tag1consulting/orgs","repos_url":"https://api.github.com/users/tag1consulting/repos","events_url":"https://api.github.com/users/tag1consulting/events{/privacy}","received_events_url":"https://api.github.com/users/tag1consulting/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tag1consulting/support","description":"8.x-1.x Drupal support module development","fork":false,"url":"https://api.github.com/repos/tag1consulting/support","forks_url":"https://api.github.com/repos/tag1consulting/support/forks","keys_url":"https://api.github.com/repos/tag1consulting/support/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tag1consulting/support/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tag1consulting/support/teams","hooks_url":"https://api.github.com/repos/tag1consulting/support/hooks","issue_events_url":"https://api.github.com/repos/tag1consulting/support/issues/events{/number}","events_url":"https://api.github.com/repos/tag1consulting/support/events","assignees_url":"https://api.github.com/repos/tag1consulting/support/assignees{/user}","branches_url":"https://api.github.com/repos/tag1consulting/support/branches{/branch}","tags_url":"https://api.github.com/repos/tag1consulting/support/tags","blobs_url":"https://api.github.com/repos/tag1consulting/support/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tag1consulting/support/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tag1consulting/support/git/refs{/sha}","trees_url":"https://api.github.com/repos/tag1consulting/support/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tag1consulting/support/statuses/{sha}","languages_url":"https://api.github.com/repos/tag1consulting/support/languages","stargazers_url":"https://api.github.com/repos/tag1consulting/support/stargazers","contributors_url":"https://api.github.com/repos/tag1consulting/support/contributors","subscribers_url":"https://api.github.com/repos/tag1consulting/support/subscribers","subscription_url":"https://api.github.com/repos/tag1consulting/support/subscription","commits_url":"https://api.github.com/repos/tag1consulting/support/commits{/sha}","git_commits_url":"https://api.github.com/repos/tag1consulting/support/git/commits{/sha}","comments_url":"https://api.github.com/repos/tag1consulting/support/comments{/number}","issue_comment_url":"https://api.github.com/repos/tag1consulting/support/issues/comments{/number}","contents_url":"https://api.github.com/repos/tag1consulting/support/contents/{+path}","compare_url":"https://api.github.com/repos/tag1consulting/support/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tag1consulting/support/merges","archive_url":"https://api.github.com/repos/tag1consulting/support/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tag1consulting/support/downloads","issues_url":"https://api.github.com/repos/tag1consulting/support/issues{/number}","pulls_url":"https://api.github.com/repos/tag1consulting/support/pulls{/number}","milestones_url":"https://api.github.com/repos/tag1consulting/support/milestones{/number}","notifications_url":"https://api.github.com/repos/tag1consulting/support/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tag1consulting/support/labels{/name}","releases_url":"https://api.github.com/repos/tag1consulting/support/releases{/id}","created_at":"2015-07-29T07:09:48Z","updated_at":"2015-08-24T14:15:02Z","pushed_at":"2015-09-02T14:29:29Z","git_url":"git://github.com/tag1consulting/support.git","ssh_url":"git@github.com:tag1consulting/support.git","clone_url":"https://github.com/tag1consulting/support.git","svn_url":"https://github.com/tag1consulting/support","homepage":null,"size":935,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":3,"forks":3,"open_issues":3,"watchers":0,"default_branch":"8.x-1.x"}},"_links":{"self":{"href":"https://api.github.com/repos/tag1consulting/support/pulls/9"},"html":{"href":"https://github.com/tag1consulting/support/pull/9"},"issue":{"href":"https://api.github.com/repos/tag1consulting/support/issues/9"},"comments":{"href":"https://api.github.com/repos/tag1consulting/support/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/tag1consulting/support/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/tag1consulting/support/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tag1consulting/support/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/tag1consulting/support/statuses/bc97389903990e59e3cff6bced51bcea85702d38"}}}}