Add ItemLink for individual view only: is it possible?

alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2008-05-16 22:46

For a particular dynamicAlbum-type view I'd like to include an itemLink but for that one view only.

I can't include it in the module.inc getItemLinks() because I have no visibility of which view is loading. If I did, it would appear everywhere.

I could include it in that View's LoadTemplate():

$theme['itemLinks'][]= array('text' => "My special item link for this view only", ...

However, in GalleryView.class the *View's* loadTemplate() is called (line 300) *before* the theme's loadTemplate() (line 308), and the theme's loadTemplate() overwrites whatever's already in the itemLinks array when it executes loadCommonTemplateData() since that's when it collects the itemLinks from the set of relevant and active modules.

Is there another way I can do this? Obviously, since this is a dynamicAlbum type I don't have my own template file in which I can insert links in a more traditional manner.

Any suggestions will be appreciated.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2008-05-20 15:39

Can you use getItemLinks but check $gallery->getCurrentView() to determine whether or not to add the link?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Tue, 2008-05-20 19:15

Almost certainly - I shall give it a try. Excellently thanks.