On Monday 12 March 2007 2:53 pm, Earl Miles wrote:
Bèr Kessels wrote:
Hello
I have a view (table listing certain nodes) wich appears on /node/123/applications its path is /node/$arg/applications
if $node 123 is of type Foo, the page /node/123/applications makes sense, for all other types it does not.
I would like to know if I can make that view 'active' or accessible, or appear as a tab, for only the node types where $node->type of 132 is 'Foo'. An alternative could be to not show the menu-item if the view is empty.
Note, that I am not looking at filters or arguments. Filters and arguments only define what nodes appear in the table on the /node/123/applications, they don't dictate wether the view is available.
Its for Drupal 4.7.
You need to uncheck 'page' and create the menu item yourself. I think the userreview module does something like this.
In the dev version of Drupal 5 I've expanded the $arg functionality, but I didn't backport that work to 4.7.
It actually doesn't matter if you check page or not, as long as you don't create a menu item from the view itself. The code I use for the custom menu entry is something like this (needs to be in !$may_cache):
if (arg(0) == 'node' && is_numeric(arg(1))) { $node = node_load(arg(1)); if ('page' == $node->type) { $items[] = array( 'path' => "node/{$node->nid}/foo", 'title' => t(Foos'), 'callback' => 'views_view_page', 'callback arguments' => array('viewname', $node->nid), 'type' => MENU_LOCAL_TASK, ); } }