Where Plugins Appear

From EPrints Documentation
Revision as of 14:55, 7 December 2010 by Pm705 (Talk | contribs)

Jump to: navigation, search

When you create a screen plugin in EPrints there are a set of locations where the plugin can appear.

You can set the location at which a screen is rendered in the new method of your plugin:

        $self->{appears} = [
                {
                        place => "item_tools",
                        position => 100,
                }
        ];

Note that this is an array so it is possible to render your screen in multiple places. You can also initiate a specific action if the button is clicked in a specific area. In the example below when the link in the key_tools area (top bar next to manage deposits) then the "create" action of our screen plugin is called.

        $self->{appears} = [
                {
                        place => "key_tools",
                        action => "create",
                        position => 100,
                },
                {
                        place => "item_tools",
                        position => 100,
                }
        ];

The position key of the hash tells EPrints what order to render the various screens in the place specified. For example if 10 plugins wish to render in the key_tools area the order they appear is calculated by comparing their position values. Lowest numbers are ordered first. In the event of two position numbers being the same behaviour is strictly undefined. In practice the first plugin loaded will generally have priority. For all screens shipped with EPrints the default positions are always in multiples of 100 where the first plugin in a list is number 100. Note that it is possible for the value of position to be negative but it is not recommend that you do this. In general aim to make your position numbers end in a zero, it helps people who have very obscure set ups.