By stclaird on
Hello Forum,
I am building a hook_link for my module, however my URL string has a several single quotes. When I do a view source in the browser the single quotes are replaced with '
For example:
onclick="Subscribe(1517,645,2726,'Drupal Forum Node 1','','','');" class="elertz_link_url">
Should look like
Subscribe(1517,645,2726,'Drupal Forum Node 2','','','');
This is my code:
/**
* Implementation of hook_link().
*/
drupal_set_html_head('<script src="http://www.elertz.com/flashclient/subscribe.js" type="text/javascript"></script>');
drupal_set_html_head('<script type="text/javascript">addSubJS();</script>');
function elertz_link($type, $node = 0, $main = 0){
$img_elertz_merecat = drupal_get_path('module', 'elertz') .'/images/elertz_16x16.gif';
$elertz_url_title = variable_get('elertz_url_title',"");
$nid = $node-> nid;
$elertz_subscription_code = variable_get('elertz_subscription_code',"");
$schema_id = variable_get('elertz_schema_id',"");
$webmaster_id = variable_get('elertz_webmaster_id',"");
$elertz_brand_id = variable_get('elertz_brand_id',"");
$elertz_subscription = ("Subscribe("
.$webmaster_id.","
.$elertz_brand_id.","
.$schema_id.","."'"
.$elertz_subscription_code." Node ".$nid."'"
.",'','','');");
$links = array();
if ($type == 'node' && $node->type == 'story' || $node->type == 'page' || $node->type =='blog' ) {
if (arg(0) != 'story' || arg(1) != $node->uid) {
$links['elertz_link_url'] = array(
//'title' => t($elertz_url_title),
'title' => t($elertz_subscription),
'href' => "",
'attributes' => array('onclick' => $elertz_subscription),
'html' => TRUE,
);
}
}
return $links;
}
Comments
That should have said
That should have said
I am building a hook_link for my module, however my URL string has a several single quotes. When I do a view source in the browser the single quotes are replaced with
'For example:
onclick="Subscribe(1517,645,2726,'Drupal Forum Node 1','','','');" class="elertz_link_url">