Gallery2:ModuleLinks - Gallery Codex
Personal tools


From Gallery Codex

Revision as of 11:49, 15 August 2008 by Valiant (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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(). Look in modules/core/ for good examples.



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 a regular View/Controller/Template as some of the work (the form declarations etc) are done by the core.ItemAdmin View/Template/Controller combination. In the example above you are looking at the RearrangeItems.tpl template from the module 'rearrange' being displayed as a sub-template of the core.ItemAdmin 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.



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.


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.


Similarly to SiteAdminViews they are declared in, in function getUserAdminViews(...). Look at core/ or watermark/ for details.


Just like ItemEditPlugins extend the "Edit Item" page, ItemAddPlugins extend the "Add Item" page. They're also registered via the factory in your module's's performFactoryRegistrations() function. See the itemadd module for examples.