{"action":"created","comment":{"url":"https://api.github.com/repos/acquia/acquia_lift/pulls/comments/41315708","id":41315708,"diff_hunk":"@@ -6,6 +6,84 @@\n  */\n \n /**\n+ * Admin form for configuring lift_event_values behavior.\n+ */\n+function acquia_lift_profiles_lift_event_values_form($form, &$form_state) {\n+  $form = array(\n+    '#attached' => array(\n+      'css' => array(\n+        drupal_get_path('module', 'acquia_lift') . '/css/acquia_lift.admin.css',\n+      ),\n+    ),\n+  );\n+\n+  $form['lift_event_values'] = array(\n+    '#tree' => TRUE,\n+    '#theme' => 'acquia_lift_profiles_lift_event_value_form_table',\n+  );\n+  $lift_event_values = variable_get('acquia_lift_profiles_lift_event_values', array());\n+  foreach(visitor_actions_get_actions() as $machine_name => $action) {\n+    $action_values = isset($lift_event_values[$machine_name]) ? $lift_event_values[$machine_name] : array();\n+    $engagement_score = isset($action_values['engagement_score']) ? $action_values['engagement_score'] : ACQUIA_LIFT_PROFILES_ENGAGEMENT_SCORE_DEFAULT;\n+    $global_value = isset($action_values['global_value']) ? $action_values['global_value'] : ACQUIA_LIFT_PROFILES_GLOBAL_VALUE_DEFAULT;\n+    $row_label = $action['label'];\n+    // If the action has a machine_name, then it is a custom action and can have\n+    // a \"Edit\" link.\n+    if (isset($action['machine_name'])) {\n+      $row_label .= ' ' . l(\n+        t('Edit'),\n+        'admin/structure/acquia_lift/visitor_action/' . $machine_name . '/edit',\n+        array(\n+          'attributes' => array(\n+            'class' => array(\n+              'ctools-use-modal',\n+              'ctools-modal-acquia-lift-style',\n+              'acquia-lift-configure',\n+            ),\n+            'id' => 'edit-visitor-action-' . $machine_name,\n+          ),\n+        )\n+      );\n+    }\n+    $row_engagement_score = array(\n+      '#type' => 'textfield',\n+      '#size' => 5,\n+      '#title' => NULL,\n+      '#default_value' => $engagement_score,\n+      '#element_validate' => array('element_validate_integer_positive'),\n+    );\n+    $row_global_value = array(\n+      '#type' => 'textfield',\n+      '#size' => 5,\n+      '#title' => NULL,\n+      '#default_value' => $global_value,\n+      '#element_validate' => array('element_validate_integer_positive'),\n+    );\n+    $form['lift_event_values'][$machine_name] = array(\n+      '#label' => $row_label,\n+      'engagement_score' => $row_engagement_score,\n+      'global_value' => $row_global_value,\n+    );\n+  }\n+\n+  $form['submit'] = array(\n+    '#type' => 'submit',\n+    '#value' => t('Save'),\n+  );\n+\n+  return $form;\n+}\n+\n+/**\n+ * Submit handler for the lift event_values configuration form.\n+ */\n+function acquia_lift_profiles_lift_event_values_form_submit($form, &$form_state) {\n+  $lift_event_values = $form_state['values']['lift_event_values'];\n+  // No additional sanitization only because all the inputs are through element_validate_integer_positive()\n+  variable_set('acquia_lift_profiles_lift_event_values', $lift_event_values);\n+}","path":"acquia_lift_profiles/acquia_lift_profiles.admin.inc","position":null,"original_position":79,"commit_id":"efc51975034bf34259092cc28f770ebf004debcc","original_commit_id":"c6d0fa5df5f13cc11dbc77955d55244c41a23a80","user":{"login":"ynx","id":1379691,"avatar_url":"https://avatars.githubusercontent.com/u/1379691?v=3","gravatar_id":"","url":"https://api.github.com/users/ynx","html_url":"https://github.com/ynx","followers_url":"https://api.github.com/users/ynx/followers","following_url":"https://api.github.com/users/ynx/following{/other_user}","gists_url":"https://api.github.com/users/ynx/gists{/gist_id}","starred_url":"https://api.github.com/users/ynx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ynx/subscriptions","organizations_url":"https://api.github.com/users/ynx/orgs","repos_url":"https://api.github.com/users/ynx/repos","events_url":"https://api.github.com/users/ynx/events{/privacy}","received_events_url":"https://api.github.com/users/ynx/received_events","type":"User","site_admin":false},"body":"system_settings_form() indeed is the better tool here. Updated in efc51975034bf34259092cc28f770ebf004debcc.","created_at":"2015-10-06T20:15:04Z","updated_at":"2015-10-06T20:15:04Z","html_url":"https://github.com/acquia/acquia_lift/pull/214#discussion_r41315708","pull_request_url":"https://api.github.com/repos/acquia/acquia_lift/pulls/214","_links":{"self":{"href":"https://api.github.com/repos/acquia/acquia_lift/pulls/comments/41315708"},"html":{"href":"https://github.com/acquia/acquia_lift/pull/214#discussion_r41315708"},"pull_request":{"href":"https://api.github.com/repos/acquia/acquia_lift/pulls/214"}}},"pull_request":{"url":"https://api.github.com/repos/acquia/acquia_lift/pulls/214","id":46701924,"html_url":"https://github.com/acquia/acquia_lift/pull/214","diff_url":"https://github.com/acquia/acquia_lift/pull/214.diff","patch_url":"https://github.com/acquia/acquia_lift/pull/214.patch","issue_url":"https://api.github.com/repos/acquia/acquia_lift/issues/214","number":214,"state":"open","locked":false,"title":"CH-3395 Engagement score and global value 1) store to and retrieve fr…","user":{"login":"ynx","id":1379691,"avatar_url":"https://avatars.githubusercontent.com/u/1379691?v=3","gravatar_id":"","url":"https://api.github.com/users/ynx","html_url":"https://github.com/ynx","followers_url":"https://api.github.com/users/ynx/followers","following_url":"https://api.github.com/users/ynx/following{/other_user}","gists_url":"https://api.github.com/users/ynx/gists{/gist_id}","starred_url":"https://api.github.com/users/ynx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ynx/subscriptions","organizations_url":"https://api.github.com/users/ynx/orgs","repos_url":"https://api.github.com/users/ynx/repos","events_url":"https://api.github.com/users/ynx/events{/privacy}","received_events_url":"https://api.github.com/users/ynx/received_events","type":"User","site_admin":false},"body":"…om database, 2) send to frontend JavaScript settings, and 3) send to Lift Web.","created_at":"2015-10-03T08:07:42Z","updated_at":"2015-10-06T20:15:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f824086da3556d6a0a3ae1a525d7c87c8f1cec4c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/acquia/acquia_lift/pulls/214/commits","review_comments_url":"https://api.github.com/repos/acquia/acquia_lift/pulls/214/comments","review_comment_url":"https://api.github.com/repos/acquia/acquia_lift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/acquia/acquia_lift/issues/214/comments","statuses_url":"https://api.github.com/repos/acquia/acquia_lift/statuses/efc51975034bf34259092cc28f770ebf004debcc","head":{"label":"acquia:CH-3395","ref":"CH-3395","sha":"efc51975034bf34259092cc28f770ebf004debcc","user":{"login":"acquia","id":514789,"avatar_url":"https://avatars.githubusercontent.com/u/514789?v=3","gravatar_id":"","url":"https://api.github.com/users/acquia","html_url":"https://github.com/acquia","followers_url":"https://api.github.com/users/acquia/followers","following_url":"https://api.github.com/users/acquia/following{/other_user}","gists_url":"https://api.github.com/users/acquia/gists{/gist_id}","starred_url":"https://api.github.com/users/acquia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acquia/subscriptions","organizations_url":"https://api.github.com/users/acquia/orgs","repos_url":"https://api.github.com/users/acquia/repos","events_url":"https://api.github.com/users/acquia/events{/privacy}","received_events_url":"https://api.github.com/users/acquia/received_events","type":"Organization","site_admin":false},"repo":{"id":17344049,"name":"acquia_lift","full_name":"acquia/acquia_lift","owner":{"login":"acquia","id":514789,"avatar_url":"https://avatars.githubusercontent.com/u/514789?v=3","gravatar_id":"","url":"https://api.github.com/users/acquia","html_url":"https://github.com/acquia","followers_url":"https://api.github.com/users/acquia/followers","following_url":"https://api.github.com/users/acquia/following{/other_user}","gists_url":"https://api.github.com/users/acquia/gists{/gist_id}","starred_url":"https://api.github.com/users/acquia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acquia/subscriptions","organizations_url":"https://api.github.com/users/acquia/orgs","repos_url":"https://api.github.com/users/acquia/repos","events_url":"https://api.github.com/users/acquia/events{/privacy}","received_events_url":"https://api.github.com/users/acquia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/acquia/acquia_lift","description":"Mirror of the drupal.org repository for Acquia Lift module","fork":false,"url":"https://api.github.com/repos/acquia/acquia_lift","forks_url":"https://api.github.com/repos/acquia/acquia_lift/forks","keys_url":"https://api.github.com/repos/acquia/acquia_lift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/acquia/acquia_lift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/acquia/acquia_lift/teams","hooks_url":"https://api.github.com/repos/acquia/acquia_lift/hooks","issue_events_url":"https://api.github.com/repos/acquia/acquia_lift/issues/events{/number}","events_url":"https://api.github.com/repos/acquia/acquia_lift/events","assignees_url":"https://api.github.com/repos/acquia/acquia_lift/assignees{/user}","branches_url":"https://api.github.com/repos/acquia/acquia_lift/branches{/branch}","tags_url":"https://api.github.com/repos/acquia/acquia_lift/tags","blobs_url":"https://api.github.com/repos/acquia/acquia_lift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/acquia/acquia_lift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/acquia/acquia_lift/git/refs{/sha}","trees_url":"https://api.github.com/repos/acquia/acquia_lift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/acquia/acquia_lift/statuses/{sha}","languages_url":"https://api.github.com/repos/acquia/acquia_lift/languages","stargazers_url":"https://api.github.com/repos/acquia/acquia_lift/stargazers","contributors_url":"https://api.github.com/repos/acquia/acquia_lift/contributors","subscribers_url":"https://api.github.com/repos/acquia/acquia_lift/subscribers","subscription_url":"https://api.github.com/repos/acquia/acquia_lift/subscription","commits_url":"https://api.github.com/repos/acquia/acquia_lift/commits{/sha}","git_commits_url":"https://api.github.com/repos/acquia/acquia_lift/git/commits{/sha}","comments_url":"https://api.github.com/repos/acquia/acquia_lift/comments{/number}","issue_comment_url":"https://api.github.com/repos/acquia/acquia_lift/issues/comments{/number}","contents_url":"https://api.github.com/repos/acquia/acquia_lift/contents/{+path}","compare_url":"https://api.github.com/repos/acquia/acquia_lift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/acquia/acquia_lift/merges","archive_url":"https://api.github.com/repos/acquia/acquia_lift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/acquia/acquia_lift/downloads","issues_url":"https://api.github.com/repos/acquia/acquia_lift/issues{/number}","pulls_url":"https://api.github.com/repos/acquia/acquia_lift/pulls{/number}","milestones_url":"https://api.github.com/repos/acquia/acquia_lift/milestones{/number}","notifications_url":"https://api.github.com/repos/acquia/acquia_lift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/acquia/acquia_lift/labels{/name}","releases_url":"https://api.github.com/repos/acquia/acquia_lift/releases{/id}","created_at":"2014-03-02T18:42:14Z","updated_at":"2014-08-25T15:09:47Z","pushed_at":"2015-10-06T20:14:35Z","git_url":"git://github.com/acquia/acquia_lift.git","ssh_url":"git@github.com:acquia/acquia_lift.git","clone_url":"https://github.com/acquia/acquia_lift.git","svn_url":"https://github.com/acquia/acquia_lift","homepage":"","size":10366,"stargazers_count":2,"watchers_count":2,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":12,"forks":8,"open_issues":12,"watchers":2,"default_branch":"master"}},"base":{"label":"acquia:7.x-2.x","ref":"7.x-2.x","sha":"3abac59316c38a1c7a59d914092eaa98d60f98d9","user":{"login":"acquia","id":514789,"avatar_url":"https://avatars.githubusercontent.com/u/514789?v=3","gravatar_id":"","url":"https://api.github.com/users/acquia","html_url":"https://github.com/acquia","followers_url":"https://api.github.com/users/acquia/followers","following_url":"https://api.github.com/users/acquia/following{/other_user}","gists_url":"https://api.github.com/users/acquia/gists{/gist_id}","starred_url":"https://api.github.com/users/acquia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acquia/subscriptions","organizations_url":"https://api.github.com/users/acquia/orgs","repos_url":"https://api.github.com/users/acquia/repos","events_url":"https://api.github.com/users/acquia/events{/privacy}","received_events_url":"https://api.github.com/users/acquia/received_events","type":"Organization","site_admin":false},"repo":{"id":17344049,"name":"acquia_lift","full_name":"acquia/acquia_lift","owner":{"login":"acquia","id":514789,"avatar_url":"https://avatars.githubusercontent.com/u/514789?v=3","gravatar_id":"","url":"https://api.github.com/users/acquia","html_url":"https://github.com/acquia","followers_url":"https://api.github.com/users/acquia/followers","following_url":"https://api.github.com/users/acquia/following{/other_user}","gists_url":"https://api.github.com/users/acquia/gists{/gist_id}","starred_url":"https://api.github.com/users/acquia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acquia/subscriptions","organizations_url":"https://api.github.com/users/acquia/orgs","repos_url":"https://api.github.com/users/acquia/repos","events_url":"https://api.github.com/users/acquia/events{/privacy}","received_events_url":"https://api.github.com/users/acquia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/acquia/acquia_lift","description":"Mirror of the drupal.org repository for Acquia Lift module","fork":false,"url":"https://api.github.com/repos/acquia/acquia_lift","forks_url":"https://api.github.com/repos/acquia/acquia_lift/forks","keys_url":"https://api.github.com/repos/acquia/acquia_lift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/acquia/acquia_lift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/acquia/acquia_lift/teams","hooks_url":"https://api.github.com/repos/acquia/acquia_lift/hooks","issue_events_url":"https://api.github.com/repos/acquia/acquia_lift/issues/events{/number}","events_url":"https://api.github.com/repos/acquia/acquia_lift/events","assignees_url":"https://api.github.com/repos/acquia/acquia_lift/assignees{/user}","branches_url":"https://api.github.com/repos/acquia/acquia_lift/branches{/branch}","tags_url":"https://api.github.com/repos/acquia/acquia_lift/tags","blobs_url":"https://api.github.com/repos/acquia/acquia_lift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/acquia/acquia_lift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/acquia/acquia_lift/git/refs{/sha}","trees_url":"https://api.github.com/repos/acquia/acquia_lift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/acquia/acquia_lift/statuses/{sha}","languages_url":"https://api.github.com/repos/acquia/acquia_lift/languages","stargazers_url":"https://api.github.com/repos/acquia/acquia_lift/stargazers","contributors_url":"https://api.github.com/repos/acquia/acquia_lift/contributors","subscribers_url":"https://api.github.com/repos/acquia/acquia_lift/subscribers","subscription_url":"https://api.github.com/repos/acquia/acquia_lift/subscription","commits_url":"https://api.github.com/repos/acquia/acquia_lift/commits{/sha}","git_commits_url":"https://api.github.com/repos/acquia/acquia_lift/git/commits{/sha}","comments_url":"https://api.github.com/repos/acquia/acquia_lift/comments{/number}","issue_comment_url":"https://api.github.com/repos/acquia/acquia_lift/issues/comments{/number}","contents_url":"https://api.github.com/repos/acquia/acquia_lift/contents/{+path}","compare_url":"https://api.github.com/repos/acquia/acquia_lift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/acquia/acquia_lift/merges","archive_url":"https://api.github.com/repos/acquia/acquia_lift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/acquia/acquia_lift/downloads","issues_url":"https://api.github.com/repos/acquia/acquia_lift/issues{/number}","pulls_url":"https://api.github.com/repos/acquia/acquia_lift/pulls{/number}","milestones_url":"https://api.github.com/repos/acquia/acquia_lift/milestones{/number}","notifications_url":"https://api.github.com/repos/acquia/acquia_lift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/acquia/acquia_lift/labels{/name}","releases_url":"https://api.github.com/repos/acquia/acquia_lift/releases{/id}","created_at":"2014-03-02T18:42:14Z","updated_at":"2014-08-25T15:09:47Z","pushed_at":"2015-10-06T20:14:35Z","git_url":"git://github.com/acquia/acquia_lift.git","ssh_url":"git@github.com:acquia/acquia_lift.git","clone_url":"https://github.com/acquia/acquia_lift.git","svn_url":"https://github.com/acquia/acquia_lift","homepage":"","size":10366,"stargazers_count":2,"watchers_count":2,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":12,"forks":8,"open_issues":12,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/acquia/acquia_lift/pulls/214"},"html":{"href":"https://github.com/acquia/acquia_lift/pull/214"},"issue":{"href":"https://api.github.com/repos/acquia/acquia_lift/issues/214"},"comments":{"href":"https://api.github.com/repos/acquia/acquia_lift/issues/214/comments"},"review_comments":{"href":"https://api.github.com/repos/acquia/acquia_lift/pulls/214/comments"},"review_comment":{"href":"https://api.github.com/repos/acquia/acquia_lift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/acquia/acquia_lift/pulls/214/commits"},"statuses":{"href":"https://api.github.com/repos/acquia/acquia_lift/statuses/efc51975034bf34259092cc28f770ebf004debcc"}}}}