summaryrefslogtreecommitdiff
path: root/modules/page
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-07-30 13:37:26 +0000
committerDries Buytaert <dries@buytaert.net>2004-07-30 13:37:26 +0000
commitaed1b0ca9e89d085b557d2d1e61da2cf07ce6072 (patch)
tree4ab29fc1a040794f1ec43f1772f8defbed2f9027 /modules/page
parent6c73823b10bed9baebfa681967bc320f69b7d813 (diff)
downloadbrdo-aed1b0ca9e89d085b557d2d1e61da2cf07ce6072.tar.gz
brdo-aed1b0ca9e89d085b557d2d1e61da2cf07ce6072.tar.bz2
- Patch #5347 by JonBob:
Here's a new patch that unifies the node/52 and book/view/52 paths for nodes. It involves a small change to hook_view(), which is discussed first: Currently hook_view() expects node modules to return a themed node. However, each module does this the same way; they modify $node as necessary, then call theme('node', $node) and return the result. We can refactor this so that the calling function node_view() calls theme('node') instead. By doing this, it becomes possible for hook_nodeapi('view') to be called after hook_view() where the node contents are filtered, and before theme('node') where the body is enclosed in other HTML. This way the book module can insert its navigation into the body right before the theming. Advantages of this refactoring: - I can use it for book.module to remove the extra viewing path. - The function of hook_nodeapi('view') becomes more like hook_view(), as neither will expect a return value. - We more closely follow the flow of other nodeapi calls, which usually directly follow their corresponding specific node type hooks (instead of preceding them). - The attachment.module people could use it to append their attachments in a list after the node. - Gabor could use it instead of his filter perversion for his "articles in a series" module. - A little less code in each view hook. - The content hook is no longer needed, so that means even less code. Disadvantages: - Any modules written to use nodeapi('view') could be affected (but these would all be post-4.4 modules). - Implementations of hook_view() would need to be updated (but return values would be ignored, so most would work without updates anyway). Now the patch takes advantage of this API shift to inject its navigation at the end of all book nodes, regardless of the viewing path. In fact, since the paths become identical, I've removed the book/view handler entirely. We should probably provide an .htaccess rewrite for this (one is still needed for node/view/nn anyway). At the same time, there is a check in book_block() that shows the block appropriately on these pages.
Diffstat (limited to 'modules/page')
-rw-r--r--modules/page/page.module4
1 files changed, 1 insertions, 3 deletions
diff --git a/modules/page/page.module b/modules/page/page.module
index a30224e70..4e03a5451 100644
--- a/modules/page/page.module
+++ b/modules/page/page.module
@@ -121,11 +121,9 @@ function page_content($node, $teaser = FALSE) {
/**
* Implementation of hook_view().
*/
-function page_view($node, $teaser = FALSE, $page = FALSE) {
+function page_view(&$node, $teaser = FALSE, $page = FALSE) {
// prepare the node content
$node = page_content($node, $teaser);
- // print the node
- return theme('node', $node, $teaser, $page);
}
/**