Last updated February 19, 2008. Created by Dries on May 30, 2005.
Edited by ax, puregin. Log in to edit this page.
Other than those mentioned above, the following hooks have changed:
-
The
_viewhook has been changed to return its content rather than printing it. It also has an extra parameter,$page, that indicates whether the node is being viewed as a standalone page or as part of a larger context. This is important because nodes may change the breadcrumb trail if they are being viewed as a page. Old usage:<?php
function example_view($node, $main = 0) {
if ($main) {
theme("node", $node, $main);
}
else {
$breadcrumb[] = l(t("Home"), "");
$breadcrumb[] = l(t("foo"), "foo");
$node->body = theme("breadcrumb", $breadcrumb) ."<br />". $node->body;
theme("node", $node, $main);
}
}
?>
New usage:<?php
function example_view($node, $main = 0, $page = 0) {
if ($main) {
return theme("node", $node, $main, $page);
}
else {
if ($page) {
$breadcrumb[] = l(t("Home"), "");
$breadcrumb[] = l(t("foo"), "foo");
drupal_set_breadcrumb($breadcrumb);
}
return theme("node", $node, $main, $page);
}
}
?> -
The
_formhook used by node modules no longer takes 3 arguments. The second argument$help, typically used to print submission guidelines, has been removed. Instead, the help should be emitted using the module's_helphook. For examples, check the story, forum or blog module. -
The
_searchhook was changed to not only return the result set array, but a two element array with the result group title and the result set array. This provides more precise control over result group titles. -
The
_headhook is eliminated and replaced with thedrupal_set_html_head()anddrupal_get_html_head()functions. You can add JavaScript code or CSS to the HTML head part with thedrupal_set_html_head()function instead. -
See also the description of the
_compose_tipshook changes below.