0
function theme_comment_thread_expanded($comment, $node) {

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

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

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

}

我不太了解这个功能。我希望这里有人可以帮助解释它。谢谢你。

4

1 回答 1

2

它从实现 hook_link() 的所有模块收集评论链接,并使用主题函数 (theme_comment_view) 对其进行格式化。

编辑:
澄清(并包括 jp 的评论):

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

这会使用函数参数“comment”、$comment 和 0调用hook_link()所有实现它的模块(即modulename_link()一个引用)。该函数module_invoke_all()累积这些链接并返回它们。

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

此调用与上一个调用类似。它调用实​​现hook_link_alter()并让它们改变链接的模块。

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

这个调用主题挂钩“comment_view”来格式化评论链接。这个钩子通常会有一个默认实现,主题可以覆盖它。

整个函数theme_comment_thread_expanded()也可以被覆盖(例如yourtheme_comment_thread_expanded())。

于 2011-02-18T13:14:40.017 回答