function _adsense_csev2_results in Google AdSense integration 7
Creates the CSE v2 search results page for site-embedded search results.
Return value
string JavaScript that embeds the Google results
1 string reference to '_adsense_csev2_results'
- adsense_cse_menu in cse/
adsense_cse.module - Implements hook_menu().
File
- cse/
adsense_csev2.results.inc, line 14 - Displays the page containing the results of the Adsense for Search box v2.
Code
function _adsense_csev2_results($slot) {
$client = adsense_get_client_slot_id();
// Log the search keys:
watchdog('AdSense search', 'Search keywords: %keywords', array(
'%keywords' => urldecode(check_plain($_GET['as_q'])),
));
// Output search results.
if (variable_get('adsense_test_mode', ADSENSE_TEST_MODE_DEFAULT)) {
$output = theme('adsense_placeholder', array(
'text' => "Results",
'height' => 100,
));
}
else {
// Add data-queryParameterName because of conflicts with Drupal's 'q' query.
$output = "<script async src='https://cse.google.com/cse.js?cx=partner-{$client}:{$slot}'></script><div class='gcse-searchresults-only' data-queryParameterName='as_q'></div>";
}
return $output;
}