diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-09-16 07:17:56 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-09-16 07:17:56 +0000 |
commit | 5c7983c4deae55ad41b85ca99db54d3fce283fd9 (patch) | |
tree | 59801cd96a36c390586752c58d6cf5ba50c230ce /modules/book.module | |
parent | 6f0fd3aa55659f8bd6b023e8e82e990326c1b788 (diff) | |
download | brdo-5c7983c4deae55ad41b85ca99db54d3fce283fd9.tar.gz brdo-5c7983c4deae55ad41b85ca99db54d3fce283fd9.tar.bz2 |
- Patch #8179 by JonBob: reintroduced menu caching.
Diffstat (limited to 'modules/book.module')
-rw-r--r-- | modules/book.module | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/modules/book.module b/modules/book.module index f4a847515..f349991fd 100644 --- a/modules/book.module +++ b/modules/book.module @@ -76,31 +76,33 @@ function book_link($type, $node = 0, $main = 0) { /** * Implementation of hook_menu(). */ -function book_menu() { +function book_menu($may_cache) { $items = array(); - $items[] = array('path' => 'node/add/book', 'title' => t('book page'), - 'access' => user_access('maintain books')); - $items[] = array('path' => 'admin/node/book', 'title' => t('books'), - 'callback' => 'book_admin', - 'access' => user_access('administer nodes'), - 'weight' => 4); - $items[] = array('path' => 'admin/node/book/orphan', 'title' => t('orphan pages'), - 'callback' => 'book_admin_orphan', - 'access' => user_access('administer nodes'), - 'weight' => 8); - $result = db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title'); - while ($book = db_fetch_object($result)) { - $items[] = array('path' => 'admin/node/book/'. $book->nid, 'title' => t('"%title" book', array('%title' => $book->title))); - } - $items[] = array('path' => 'book', 'title' => t('books'), - 'callback' => 'book_render', - 'access' => user_access('access content'), - 'type' => MENU_SUGGESTED_ITEM); - $items[] = array('path' => 'book/print', 'title' => t('printer-friendly version'), - 'callback' => 'book_print', - 'access' => user_access('access content'), - 'type' => MENU_CALLBACK); + if ($may_cache) { + $items[] = array('path' => 'node/add/book', 'title' => t('book page'), + 'access' => user_access('maintain books')); + $items[] = array('path' => 'admin/node/book', 'title' => t('books'), + 'callback' => 'book_admin', + 'access' => user_access('administer nodes'), + 'weight' => 4); + $items[] = array('path' => 'admin/node/book/orphan', 'title' => t('orphan pages'), + 'callback' => 'book_admin_orphan', + 'access' => user_access('administer nodes'), + 'weight' => 8); + $result = db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title'); + while ($book = db_fetch_object($result)) { + $items[] = array('path' => 'admin/node/book/'. $book->nid, 'title' => t('"%title" book', array('%title' => $book->title))); + } + $items[] = array('path' => 'book', 'title' => t('books'), + 'callback' => 'book_render', + 'access' => user_access('access content'), + 'type' => MENU_SUGGESTED_ITEM); + $items[] = array('path' => 'book/print', 'title' => t('printer-friendly version'), + 'callback' => 'book_print', + 'access' => user_access('access content'), + 'type' => MENU_CALLBACK); + } return $items; } |