function template_preprocess_pardot_js in Pardot Integration 6
Process pardot_js variables and add settings.
@group themeable
File
- ./
pardot.module, line 207 - ParDot integration module.
Code
function template_preprocess_pardot_js(&$vars) {
$vars['pardot_a_id'] = variable_get('pardot_a_id', '');
// Compare with the internal and path alias (if any) to find any special campaigns.
$results = db_query('SELECT campaign_id, paths FROM {pardot_campaign}');
while ($row = db_fetch_object($results)) {
$path = drupal_get_path_alias($_GET['q']);
// Compare with the internal and path alias (if any).
$page_match = drupal_match_path($path, $row->paths);
if ($path != $_GET['q']) {
$page_match = $page_match || drupal_match_path($_GET['q'], $row->paths);
}
if ($page_match) {
$vars['pardot_c_id'] = $row->campaign_id;
break;
}
}
if (empty($vars['pardot_c_id'])) {
$vars['pardot_c_id'] = variable_get('pardot_c_id', '');
}
// Compare with the internal and path alias (if any) and add scoring.
$path = drupal_get_path_alias($_GET['q']);
$score = db_result(db_query("SELECT score FROM {pardot_scoring} WHERE path = '%s'", $path));
if (!$score) {
$score = db_result(db_query("SELECT score FROM {pardot_scoring} WHERE path = '%s'", $_GET['q']));
}
$vars['score'] = $score;
}