Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
20 May 2006 at 04:26 UTC
Updated:
10 Jan 2008 at 13:12 UTC
This patch addes a new field to the menu which allows the view to have the menu turned off and on depending on what you need.
The case that I need this for, is that I want to add a tab to an group, and so I add a little check to make sure the node it a og node, to allow it.
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->type == 'og') {
return TRUE;
}
}
This will mean the tab will only display on og type nodes.
| Comment | File | Size | Author |
|---|---|---|---|
| views_menu_php.patch.txt | 4.94 KB | gordon |
Comments
Comment #1
merlinofchaos commentedI don't think I like this. I can see the need, but you can accomplish the exact same thing by creating your own menu and linking it to the view, which gives you greater control.
I'll sit on this for awhile, and take other people's opinions.
Comment #2
gordon commentedCan you please give an example.
I think I know what you are saying, but this would mean a lot more code than just the little snippet that is required with my patch. And this would put it out of the reach of a normal admin with no development skills.
Comment #3
merlinofchaos commenteduserreview module uses a construct like this:
Comment #4
gordon commentedI guessed that it was something like this, but as I said this then puts this out of the reach of a average site admin which can do some php for blocks, and maybe content, but developing an entire module (even just a small one) will be over/or perceived to be over their head.
Comment #5
merlinofchaos commentedOk, I'm not going to do this. However!
I'm thinking of a patch that allows $arg to be different values:
$user
$node
So that it could at least validate that $user and $node exist. Perhaps even going so far as $node-type or some such, but that's getting pretty complex and ugly.
Comment #6
gordon commentedYes being able to do $node-type would be great. I think this is all that I have ever done
Comment #7
catch