Gallery2:ModuleLinks - Gallery Codex
Personal tools

Gallery2:ModuleLinks

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

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

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

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

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.

==

advertisements