[development] Interacting with Views Tabs via code
Sam Tresler
sam at treslerdesigns.com
Mon Mar 29 20:47:59 UTC 2010
That works. Thanks!
I weighted my module heavier, and added it at that juncture. I agree
creating the parent_item in a module may be cleaner, but as the tab I
need won't be the default I thought that might get needlessly
difficult. I might, in the near future, move the view to code, move
all the tabs to a hook_menu and call the view specifically there, so I
can not need to implement the menu_alter, but for now this works.
Cheers, Sam
On Mar 29, 2010, at 2:34 PM, larry at garfieldtech.com wrote:
> Views does all of its menu manipulation in hook_menu_alter already,
> so if your hook_menu_alter runs first then the views additions won't
> be there. Try setting your module weight to heavier than views.
>
> Alternatively, create your page first using hook_menu as the default
> tab and then tweak the view to just add tabs to the page you already
> created. That may be the cleaner approach.
>
> --Larry Garfield
>
> On 3/29/10 10:58 AM, Sam Tresler wrote:
>> Hello,
>>
>> Not sure if this is the best place, but I've come across an
>> interesting
>> problem and I'm not certain how to proceed. I have a 3 tabbed view
>> (you
>> can actually see the live version here:
>> http://livestrongaction.org/featured_dedications). I want to add a
>> 4th
>> tab, and thought this would be simply adding a custom module with
>> hook_menu and a MENU_LOCAL_TASK. However, it appears that views is
>> doing
>> something that prevents hook_menu from interacting there. I next
>> thought
>> I would try hook_menu_alter, but I can't see the three tabs being
>> rendered in the &$items array passed into that hook.
>>
>> Now, I could just intercept this at the theme level and add what I
>> needed, but that seems kludgy. I'm tempted to move the entire view
>> into
>> code, but not sure how that would necessarily help this situtation. I
>> may ask on IRC< or the views support queue, but thought this list
>> may be
>> able to give me a few leads.
>>
>> Any idea how to get a menu tab to render on a tabbed view? Hope I'm
>> not
>> missing something obvious. Thanks in advance.
>>
>> -Sam Tresler
>>
>>
More information about the development
mailing list