开发者

What does the theme_comment_thread_expanded function do in the drupal comment module?

开发者 https://www.devze.com 2023-02-10 19:54 出处:网络
function theme_comment_thread_expande开发者_高级运维d($comment, $node) { $links = module_invoke_all(\'link\', \'comment\', $comment, 0);
function theme_comment_thread_expande开发者_高级运维d($comment, $node) {

    $links = module_invoke_all('link', 'comment', $comment, 0);

    drupal_alter('link', $links, $node, $comment);

    return theme('comment_view', $comment, $node, $links);

}

I don't understand this function well. I hope someone here can help explain it. Thank you.


It gathers links for comments from all modules that implement the hook_link() and formats them with theme functions (theme_comment_view).

Edit:
To clarify (and to include jp's comment):

$links = module_invoke_all('link', 'comment', $comment, 0);

This calls the hook_link() function for all modules that implement it (that is modulename_link()) with the function arguments 'comment', $comment and 0. Those modules return links to be put underneath comments (e.g the quote module returns a link for adding comments with the previous one quoted). The function module_invoke_all() accumulated these links and returns them.

drupal_alter('link', $links, $node, $comment);

This call is similar to the previous one. It calls modules which implement hook_link_alter() and lets them alter the links.

return theme('comment_view', $comment, $node, $links);

This one calls the theme hook "comment_view" to format the comment links. There will usually be a default implementation of this hook and themes can override it.

The whole function theme_comment_thread_expanded() can be overridden as well (e.g. yourtheme_comment_thread_expanded()).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号