Gallery2:ModuleLinks - Gallery Codex
Personal tools


From Gallery Codex

Revision as of 13:06, 3 August 2008 by Alecmyers (Talk | contribs) (Where Gallery can display links to your module)

Where Gallery can display links to your module

Gallery has lots of places module authors can add action links and tabs. Here's a brief overview of some of them, with pointers to canonical (core code) examples that you can copy and modify when writing your own modules.


SystemLinks appear at the top of every Gallery Page. They're declared in, in function getSystemLinks().



ItemLinks are the actions that apply to each item. In Matrix Theme (the default) the ItemLinks for the current item usually appear in the left sidebar. For album views there's a dropdown or list of ItemLinks for each item in the album too. ItemLinks are declared by modules also in, in function getItemLinks(...). Your module can distinguish between the main item for the page which has $wantsDetailedLinks[] set to true for that item, and contained items. See /modules/core/, in class CoreModule for examples.



ItemAdminViews are things that do administrative actions on items. Mostly they are also declared as ItemLinks too. ItemAdminViews are implemented as subviews of the core.ItemAdmin view so the declaration of the View and its corresponding Controller and Template is somewhat different to normal, as some of the work (form declarations etc) are done by the main ItemAdmin View/Template/Controller. In the example above you are looking at the RearrangeItems.tpl template from the 'rearrange' module, displayed as 'sub-template' of the core.ItemEdit template.


The link to a module's site-wide administration page - the main administration page for the module, if it has one - is a SiteAdminView. Again this is declared in the module's file, in function getSiteAdminViews(). A module can have more than one admin page - just go ahead and declare them. SiteAdminViews.gif


Modules can add tabs to the "Edit Item" page by way of ItemEditPlugins. These are declared in the file via a registerFactoryImplementation() call in the performFactoryRegistrations() function. See, for instance, watermark/ for an example. File:ItemEditPlugin.gif Naturally you can choose for which kind of items your module displays the ItemEditPlugin, showing a tab that makes sense only for editing of an album item only when editing an album, etc.


UserAdminViews are shown in the sidebar when you edit a user account. UserAdminViews.gif Similarly to SiteAdminViews they are declared in, in function getUserAdminViews(...). Look at core/ or watermark/ for details.