function dialog_comment_comment_view in Dialog 7
Same name and namespace in other branches
- 7.2 modules/dialog_comment/dialog_comment.module \dialog_comment_comment_view()
Implement hook_comment_view().
File
- modules/
dialog_comment/ dialog_comment.module, line 20
Code
function dialog_comment_comment_view(&$comment, $build_mode) {
// Modify the comment links.
$links = isset($comment->content['links']['comment']['#links']) ? $comment->content['links']['comment']['#links'] : array();
if (isset($links['comment_delete'])) {
// State that we'll be using the dialog.
$links['comment_delete']['attributes']['class'][] = 'use-dialog use-ajax';
$links['comment_delete']['href'] = str_replace('/delete', '/nojs/delete', $links['comment_delete']['href']);
$links['comment_delete']['#attached']['library'][] = array(
'dialog',
'dialog',
);
}
// Set the links back in their place.
if (isset($comment->content['links']['comment']['#links'])) {
$comment->content['links']['comment']['#links'] = $links;
}
}