{"action":"created","comment":{"url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls/comments/23285281","id":23285281,"diff_hunk":"@@ -313,6 +380,128 @@ function training_form_user_login_block_alter(&$form, &$form_state, $form_id) {\n }\n \n /**\n+ * Implements hook_field_formatter_info().\n+ */\n+function training_field_formatter_info() {\n+  return array(\n+    'text_formated' => array(\n+      'lable' => t('Formated text'),\n+      'field types' => array('text'),\n+      'settings' => array(\n+        'format' => '%s'\n+      ),\n+    ),\n+  );\n+}\n+\n+/**\n+ * Implements hook_field_formatter_settings_form().\n+ */\n+function training_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {\n+  $display = $instance['display'][$view_mode];\n+  $settings = $display['settings'];\n+  $element = array();\n+  if ($display['type'] == 'text_formatted') {\n+    $element['format'] = array(\n+      '#title' => t('Format'),\n+      '#type' => 'textfield',\n+      '#size' => 20,\n+      '#default_value' => $settings['format'],\n+      '#required' => TRUE,\n+    );\n+  }\n+\n+  return $element;\n+}\n+\n+/**\n+ * Implements hook_field_formatter_settings_summary().\n+ */\n+function training_field_formatter_settings_summary($field, $instance, $view_mode) {\n+  $display = $instance['display'][$view_mode];\n+  $settings = $display['settings'];\n+  $summary = t('Use a \"@format\" format to display this field', array(\n+    '@format' => $settings['format'],\n+  ));\n+\n+  return $summary;\n+}\n+\n+/**\n+ * Implements hook_field_formatter_view().\n+ */\n+function training_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {\n+  $element = array();\n+  $settings = $display['settings'];\n+  switch ($display['type']) {\n+    case 'text_formated':\n+      foreach ($items as $delta => $item) {\n+        $element[$delta] = array('#markup' => sprintf($settings['format'], $item['value']));\n+      }\n+      break;\n+  }\n+\n+  return $element;\n+}\n+\n+/**\n+ * Implements hook_entity_info().\n+ */\n+function training_entity_info() {\n+  $return = array(\n+    'training_item' => array(\n+      'label' => t('Task'),\n+      'entity class' => 'Entity',\n+      'controller class' => 'EntityAPIController',\n+      'base table' => 'training',\n+      'fieldable' => FALSE,\n+      'entity keys' => array(\n+        'id' => 'id',\n+      ),\n+      'bundle keys' => array(),\n+      'bundles' => array(),\n+      'load hook' => 'training_item_load',\n+      'view modes' => array(),\n+      'label callback' => 'entity class label',\n+      'uri callback' => 'entity class uri',\n+      'module' => 'training',\n+      'access callback' => 'training_access',\n+    ),\n+    'text_msg' => array(\n+      'label' => t('Text message'),\n+      'entity class' => 'Entity',\n+      'controller class' => 'EntityAPIController',\n+      'base table' => 'text_message',\n+      'fieldable' => FALSE,\n+      'entity keys' => array(\n+        'id' => 'id',\n+      ),\n+      'bundle keys' => array(),\n+      'bundles' => array(),\n+      'load hook' => 'text_msg_load',\n+      'view modes' => array(),","path":"training/training.module","position":188,"original_position":188,"commit_id":"0e6f74a064266f63d0e3b3693fbcbe464d8301cd","original_commit_id":"0e6f74a064266f63d0e3b3693fbcbe464d8301cd","user":{"login":"rostislav-sergeenkov","id":4550317,"avatar_url":"https://avatars.githubusercontent.com/u/4550317?v=3","gravatar_id":"","url":"https://api.github.com/users/rostislav-sergeenkov","html_url":"https://github.com/rostislav-sergeenkov","followers_url":"https://api.github.com/users/rostislav-sergeenkov/followers","following_url":"https://api.github.com/users/rostislav-sergeenkov/following{/other_user}","gists_url":"https://api.github.com/users/rostislav-sergeenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/rostislav-sergeenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rostislav-sergeenkov/subscriptions","organizations_url":"https://api.github.com/users/rostislav-sergeenkov/orgs","repos_url":"https://api.github.com/users/rostislav-sergeenkov/repos","events_url":"https://api.github.com/users/rostislav-sergeenkov/events{/privacy}","received_events_url":"https://api.github.com/users/rostislav-sergeenkov/received_events","type":"User","site_admin":false},"body":"remove, empty array is a default value","created_at":"2015-01-21T08:55:44Z","updated_at":"2015-01-21T08:55:44Z","html_url":"https://github.com/rostislav-sergeenkov/drupal_training/pull/4#discussion_r23285281","pull_request_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls/comments/23285281"},"html":{"href":"https://github.com/rostislav-sergeenkov/drupal_training/pull/4#discussion_r23285281"},"pull_request":{"href":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls/4","id":27504822,"html_url":"https://github.com/rostislav-sergeenkov/drupal_training/pull/4","diff_url":"https://github.com/rostislav-sergeenkov/drupal_training/pull/4.diff","patch_url":"https://github.com/rostislav-sergeenkov/drupal_training/pull/4.patch","issue_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/issues/4","number":4,"state":"open","locked":false,"title":"webinar 4. entity and access","user":{"login":"TatsianaShukevich","id":10208027,"avatar_url":"https://avatars.githubusercontent.com/u/10208027?v=3","gravatar_id":"","url":"https://api.github.com/users/TatsianaShukevich","html_url":"https://github.com/TatsianaShukevich","followers_url":"https://api.github.com/users/TatsianaShukevich/followers","following_url":"https://api.github.com/users/TatsianaShukevich/following{/other_user}","gists_url":"https://api.github.com/users/TatsianaShukevich/gists{/gist_id}","starred_url":"https://api.github.com/users/TatsianaShukevich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TatsianaShukevich/subscriptions","organizations_url":"https://api.github.com/users/TatsianaShukevich/orgs","repos_url":"https://api.github.com/users/TatsianaShukevich/repos","events_url":"https://api.github.com/users/TatsianaShukevich/events{/privacy}","received_events_url":"https://api.github.com/users/TatsianaShukevich/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-16T13:23:06Z","updated_at":"2015-01-21T08:55:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e12a81a872dbce941a795d542812977fd22dc3ae","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls/4/commits","review_comments_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls/4/comments","review_comment_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/issues/4/comments","statuses_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/statuses/0e6f74a064266f63d0e3b3693fbcbe464d8301cd","head":{"label":"TatsianaShukevich:master","ref":"master","sha":"0e6f74a064266f63d0e3b3693fbcbe464d8301cd","user":{"login":"TatsianaShukevich","id":10208027,"avatar_url":"https://avatars.githubusercontent.com/u/10208027?v=3","gravatar_id":"","url":"https://api.github.com/users/TatsianaShukevich","html_url":"https://github.com/TatsianaShukevich","followers_url":"https://api.github.com/users/TatsianaShukevich/followers","following_url":"https://api.github.com/users/TatsianaShukevich/following{/other_user}","gists_url":"https://api.github.com/users/TatsianaShukevich/gists{/gist_id}","starred_url":"https://api.github.com/users/TatsianaShukevich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TatsianaShukevich/subscriptions","organizations_url":"https://api.github.com/users/TatsianaShukevich/orgs","repos_url":"https://api.github.com/users/TatsianaShukevich/repos","events_url":"https://api.github.com/users/TatsianaShukevich/events{/privacy}","received_events_url":"https://api.github.com/users/TatsianaShukevich/received_events","type":"User","site_admin":false},"repo":{"id":28263098,"name":"drupal_training","full_name":"TatsianaShukevich/drupal_training","owner":{"login":"TatsianaShukevich","id":10208027,"avatar_url":"https://avatars.githubusercontent.com/u/10208027?v=3","gravatar_id":"","url":"https://api.github.com/users/TatsianaShukevich","html_url":"https://github.com/TatsianaShukevich","followers_url":"https://api.github.com/users/TatsianaShukevich/followers","following_url":"https://api.github.com/users/TatsianaShukevich/following{/other_user}","gists_url":"https://api.github.com/users/TatsianaShukevich/gists{/gist_id}","starred_url":"https://api.github.com/users/TatsianaShukevich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TatsianaShukevich/subscriptions","organizations_url":"https://api.github.com/users/TatsianaShukevich/orgs","repos_url":"https://api.github.com/users/TatsianaShukevich/repos","events_url":"https://api.github.com/users/TatsianaShukevich/events{/privacy}","received_events_url":"https://api.github.com/users/TatsianaShukevich/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TatsianaShukevich/drupal_training","description":"Drupal Training","fork":true,"url":"https://api.github.com/repos/TatsianaShukevich/drupal_training","forks_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/forks","keys_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/teams","hooks_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/hooks","issue_events_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/issues/events{/number}","events_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/events","assignees_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/assignees{/user}","branches_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/branches{/branch}","tags_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/tags","blobs_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/git/refs{/sha}","trees_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/statuses/{sha}","languages_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/languages","stargazers_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/stargazers","contributors_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/contributors","subscribers_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/subscribers","subscription_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/subscription","commits_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/commits{/sha}","git_commits_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/git/commits{/sha}","comments_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/comments{/number}","issue_comment_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/issues/comments/{number}","contents_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/contents/{+path}","compare_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/merges","archive_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/downloads","issues_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/issues{/number}","pulls_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/pulls{/number}","milestones_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/milestones{/number}","notifications_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/labels{/name}","releases_url":"https://api.github.com/repos/TatsianaShukevich/drupal_training/releases{/id}","created_at":"2014-12-20T09:45:03Z","updated_at":"2015-01-16T13:17:15Z","pushed_at":"2015-01-16T13:17:14Z","git_url":"git://github.com/TatsianaShukevich/drupal_training.git","ssh_url":"git@github.com:TatsianaShukevich/drupal_training.git","clone_url":"https://github.com/TatsianaShukevich/drupal_training.git","svn_url":"https://github.com/TatsianaShukevich/drupal_training","homepage":null,"size":221,"stargazers_count":0,"watchers_count":0,"language":"CSS","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":"master"}},"base":{"label":"rostislav-sergeenkov:master","ref":"master","sha":"b50f9688208dd9cc3dfa717e5c4798d86752c948","user":{"login":"rostislav-sergeenkov","id":4550317,"avatar_url":"https://avatars.githubusercontent.com/u/4550317?v=3","gravatar_id":"","url":"https://api.github.com/users/rostislav-sergeenkov","html_url":"https://github.com/rostislav-sergeenkov","followers_url":"https://api.github.com/users/rostislav-sergeenkov/followers","following_url":"https://api.github.com/users/rostislav-sergeenkov/following{/other_user}","gists_url":"https://api.github.com/users/rostislav-sergeenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/rostislav-sergeenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rostislav-sergeenkov/subscriptions","organizations_url":"https://api.github.com/users/rostislav-sergeenkov/orgs","repos_url":"https://api.github.com/users/rostislav-sergeenkov/repos","events_url":"https://api.github.com/users/rostislav-sergeenkov/events{/privacy}","received_events_url":"https://api.github.com/users/rostislav-sergeenkov/received_events","type":"User","site_admin":false},"repo":{"id":28262549,"name":"drupal_training","full_name":"rostislav-sergeenkov/drupal_training","owner":{"login":"rostislav-sergeenkov","id":4550317,"avatar_url":"https://avatars.githubusercontent.com/u/4550317?v=3","gravatar_id":"","url":"https://api.github.com/users/rostislav-sergeenkov","html_url":"https://github.com/rostislav-sergeenkov","followers_url":"https://api.github.com/users/rostislav-sergeenkov/followers","following_url":"https://api.github.com/users/rostislav-sergeenkov/following{/other_user}","gists_url":"https://api.github.com/users/rostislav-sergeenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/rostislav-sergeenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rostislav-sergeenkov/subscriptions","organizations_url":"https://api.github.com/users/rostislav-sergeenkov/orgs","repos_url":"https://api.github.com/users/rostislav-sergeenkov/repos","events_url":"https://api.github.com/users/rostislav-sergeenkov/events{/privacy}","received_events_url":"https://api.github.com/users/rostislav-sergeenkov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rostislav-sergeenkov/drupal_training","description":"Drupal Training","fork":false,"url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training","forks_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/forks","keys_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/teams","hooks_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/hooks","issue_events_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/issues/events{/number}","events_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/events","assignees_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/assignees{/user}","branches_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/branches{/branch}","tags_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/tags","blobs_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/git/refs{/sha}","trees_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/statuses/{sha}","languages_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/languages","stargazers_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/stargazers","contributors_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/contributors","subscribers_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/subscribers","subscription_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/subscription","commits_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/commits{/sha}","git_commits_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/git/commits{/sha}","comments_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/comments{/number}","issue_comment_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/issues/comments/{number}","contents_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/contents/{+path}","compare_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/merges","archive_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/downloads","issues_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/issues{/number}","pulls_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls{/number}","milestones_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/milestones{/number}","notifications_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/labels{/name}","releases_url":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/releases{/id}","created_at":"2014-12-20T09:18:47Z","updated_at":"2015-01-14T11:01:30Z","pushed_at":"2015-01-14T11:01:30Z","git_url":"git://github.com/rostislav-sergeenkov/drupal_training.git","ssh_url":"git@github.com:rostislav-sergeenkov/drupal_training.git","clone_url":"https://github.com/rostislav-sergeenkov/drupal_training.git","svn_url":"https://github.com/rostislav-sergeenkov/drupal_training","homepage":null,"size":217,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls/4"},"html":{"href":"https://github.com/rostislav-sergeenkov/drupal_training/pull/4"},"issue":{"href":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/issues/4"},"comments":{"href":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/rostislav-sergeenkov/drupal_training/statuses/0e6f74a064266f63d0e3b3693fbcbe464d8301cd"}}}}