Gallery2:ModuleLinks - Gallery Codex
Personal tools

Gallery2:ModuleLinks

From Gallery Codex

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

SystemLinks appear at the top of every Gallery Page. They're declared in module.inc, in function getSystemLinks(). Look in modules/core/module.inc for good examples.

Links1.gif

ItemLinks

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 main.inc, 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/module.inc, in class CoreModule for examples.

ItemAdminViews

ItemAdminViews.gif

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.

SiteAdminViews

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 module.inc file, in function getSiteAdminViews(). A module can have more than one admin page - just go ahead and declare them.

SiteAdminViews.gif

itemEditPlugins

Modules can add tabs to the "Edit Item" page by way of ItemEditPlugins. These are declared in the module.inc file via a registerFactoryImplementation() call in the performFactoryRegistrations() function. See, for instance, watermark/module.inc for an example.

ItemEditPlugins.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

UserAdminViews are shown in the sidebar when you edit a user account.

UserAdminViews.gif

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

ItemAddPlugins

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 module.inc's performFactoryRegistrations() function. See the itemadd module for examples.

ItemAddPlugins.gif