Index: pageroute.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pageroute/pageroute.module,v retrieving revision 1.39.2.33 diff -u -r1.39.2.33 pageroute.module --- pageroute.module 6 Nov 2007 15:52:28 -0000 1.39.2.33 +++ pageroute.module 3 Jun 2009 22:09:18 -0000 @@ -18,6 +18,7 @@ */ define('PAGEROUTE_BUTTON_TABS', 1); define('PAGEROUTE_MENU_TABS', 2); +define('PAGEROUTE_BLOCK_TABS', 3); // include own page type implementations include_once(drupal_get_path('module', 'pageroute') .'/pageroute_pages.inc'); @@ -111,6 +112,55 @@ } } +/** + * Implementation of hook_block(). + */ +function pageroute_block($op = 'list', $delta = 0, $edit = array()) { + switch ($op) { + case 'list': + $blocks['pageroute_tabs'] = array( + 'info' => t('Pageroute Tabs'), + ); + return $blocks; + break; + case 'view': + if ($delta == 'pageroute_tabs') { + $block = array( + 'subject' => t('Pageroute Tabs'), + ); + // Search, if we are inside a pageroute by using the cached menu items in $_menu + $path = $_GET['q']; + global $_menu; + while ($path && !isset($_menu['callbacks'][$path])) { + $path = substr($path, 0, strrpos($path, '/')); + } + if ($_menu['callbacks'][$path]['callback'] == 'pageroute_show_route') { + //we are inside a pageroute + $route = $_menu['callbacks'][$path]['callback arguments'][0]; + if ($route->options['tabs'] == PAGEROUTE_BLOCK_TABS) { + $items = array(); + foreach ($route->pages as $index => $data) { + if (!isset($data['no_tab']) || !$data['no_tab']) { + $items[] = array( + 'data' => l( + $data['title'] ? $data['title'] : $data['name'], + $route->path .'/'. $data['name'] + ), + ); + } + } + if (!empty($items)) { + $block['subject'] = $route->path; + $block['content'] = theme('item_list', $items); + } + } + } + return $block; + } + break; + } +} + /* * Gets the substring, that contains all pageroute arguments to the routes path */ Index: pageroute_ui.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pageroute/pageroute_ui.module,v retrieving revision 1.29.2.7 diff -u -r1.29.2.7 pageroute_ui.module --- pageroute_ui.module 11 Oct 2007 12:35:51 -0000 1.29.2.7 +++ pageroute_ui.module 3 Jun 2009 22:09:18 -0000 @@ -169,6 +169,7 @@ 0 => t('Don\'t show any tabs'), PAGEROUTE_MENU_TABS => t('Use the common drupal menu tabs'), PAGEROUTE_BUTTON_TABS => t('Show tab-like submit buttons above the page content.'), + PAGEROUTE_BLOCK_TABS => t('Display links in a block.'), ), '#default_value' => isset($route->options['tabs']) ? $route->options['tabs'] : 0, '#description' => t('Note that the commom drupal menu tabs won\'t save the actual form, if they are used. Also any arguments appended to the URL will be lost. They are in particular useful for pageroutes, which focus on displaying content.'),