Cascaded parameters

hollymcr

Joined: 2006-02-06
Posts: 2
Posted: Mon, 2006-02-06 16:31

I've been banging my head against the wall all day on this one, so hopefully someone can tell me if I'm just being daft.

If I want to get a module parameter I use:

GalleryCoreApi::getPluginParameter(
                'module', 'mymodule', 'myparam', $itemId)

.. where $itemId is the photo or album I'm interested in.

How do I allow parameters to cascade through from the root album allowing them to be overridden at any level? ie make the above (or similar) function return the specific value for the photo I'm interested in (if defined), or else the value for the album its in, or else the value for the parent album, etc?

I can see evidence of this happening elsewhere but cannot for the life of me work out which API function to use!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2006-02-06 17:24

you'll have to fetch the parentsequence of the item and get the parameter for each of the parent / grand parent / ... until you get something returned.
that's an expensive operation if you need to do it on each album / photo view.

alternatively you could make sure that each item has this setting, even if it's the same as the default / parent value. -> expensive when changing values. -> expensive since it adds a lot of rows to pluginParameterMap -> makes everything slower.

 
hollymcr

Joined: 2006-02-06
Posts: 2
Posted: Tue, 2006-02-07 07:33

Ouch!

There seem to be other places where this sort of thing is done (eg setting thumbnail sizes etc) where a setting at one level applies to albums and picture below it. How is this done elsewhere?