GitHub PullRequestReviewCommentEvent at 2014-05-20 18:37:14
Repository: drupalhub
Actor: RoySegall
Payload: {"comment":{"url":"https://api.github.com/repos/DrupalHub/drupalhub/pulls/comments/12860548","id":12860548,"diff_hunk":"@@ -0,0 +1,51 @@\n+<?php\n+/**\n+ * @file\n+ * Code for the drupalhub_node_count\n+ */\n+\n+/**\n+ * Implements hook_form_alter().\n+ * \n+ * disable editing of drupalhub_node_count in edit form\n+ */\n+function drupalhub_node_count_form_alter(&$form, &$form_state, $form_id){\n+  //change all edit node forms\n+  if(preg_match(\"/.+?_node_form/\",$form_id)){\n+    if(isset($form['drupalhub_node_count'])){\n+      unset($form['drupalhub_node_count']);\n+      }\n+    }\n+  }\n+/**\n+ * Implements hook_node_type_insert().\n+ * \n+ * adding count_node field to all new node types\n+ */\n+function drupalhub_node_count_node_type_insert($info){\n+\t//include install file to use function\n+\tmodule_load_include('install', 'drupalhub_node_count', 'drupalhub_node_count');\n+\n+\tdrupalhub_node_count_add_instance($info->type);\n+\t}\n+\n+/**\n+ * Implements hook_node_view().\n+ * \n+ * increasing drupalhub_node_count if node is viewing  in full mode\n+ * excluding author viewing\n+ */  \n+function drupalhub_node_count_node_view($node, $view_mode, $langcode){\n+if($view_mode == 'full'){\n+  global $user;\n+  if($user->uid != $node->uid){\n+    try{\n+      $node_wrap = entity_metadata_wrapper('node', $node);","path":"drupalhub/modules/drupalhub/drupalhub_node_count/drupalhub_node_count.module","position":43,"original_position":43,"commit_id":"3a0e0f74e6a022f93047554cdb61fb52f7a348e9","original_commit_id":"3a0e0f74e6a022f93047554cdb61fb52f7a348e9","user":{"login":"RoySegall","id":1222368,"avatar_url":"https://avatars.githubusercontent.com/u/1222368?","gravatar_id":"4f56597a143842c66a426f5da1e3d751","url":"https://api.github.com/users/RoySegall","html_url":"https://github.com/RoySegall","followers_url":"https://api.github.com/users/RoySegall/followers","following_url":"https://api.github.com/users/RoySegall/following{/other_user}","gists_url":"https://api.github.com/users/RoySegall/gists{/gist_id}","starred_url":"https://api.github.com/users/RoySegall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoySegall/subscriptions","organizations_url":"https://api.github.com/users/RoySegall/orgs","repos_url":"https://api.github.com/users/RoySegall/repos","events_url":"https://api.github.com/users/RoySegall/events{/privacy}","received_events_url":"https://api.github.com/users/RoySegall/received_events","type":"User","site_admin":false},"body":"Replace to wrapper. also - no need for the try catch. We do want exception when the field not exists.","created_at":"2014-05-20T18:37:14Z","updated_at":"2014-05-20T18:37:14Z","html_url":"https://github.com/DrupalHub/drupalhub/pull/41#discussion_r12860548","pull_request_url":"https://api.github.com/repos/DrupalHub/drupalhub/pulls/41","_links":{"self":{"href":"https://api.github.com/repos/DrupalHub/drupalhub/pulls/comments/12860548"},"html":{"href":"https://github.com/DrupalHub/drupalhub/pull/41#discussion_r12860548"},"pull_request":{"href":"https://api.github.com/repos/DrupalHub/drupalhub/pulls/41"}}}}