function dialog_comment_link_alter in Dialog 6
Implementation of hook_link_alter().
File
- modules/
dialog_comment/ dialog_comment.module, line 44 - Provides Dialog integration for the core comment module. NOTE: In order for the edit, delete and reply links on comments to work, you must patch the Drupal 6 comment module with the patch from http://drupal.org/node/374463#comment-2393592.
Code
function dialog_comment_link_alter(&$links, $node) {
foreach ($links as $id => $link) {
switch ($id) {
case 'comment_add':
case 'comment_reply':
dialog_add_js();
$links[$id]['href'] = str_replace('comment/reply', 'comment/nojs/reply', $link['href']);
$links[$id]['attributes']['class'] = 'ctools-use-dialog';
break;
case 'comment_edit':
dialog_add_js();
$links[$id]['href'] = str_replace('comment/edit', 'comment/nojs/edit', $link['href']);
$links[$id]['attributes']['class'] = 'ctools-use-dialog';
break;
case 'comment_delete':
dialog_add_js();
$links[$id]['href'] = str_replace('comment/delete', 'comment/nojs/delete', $link['href']);
$links[$id]['attributes']['class'] = 'ctools-use-dialog';
break;
}
}
}