Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Customizing the Default Array for Image Gallery in the Config


Reply


3 Posts   794 Views

Avatar
Andrew Houle

Community Member, 132 Posts

28 October 2009 at 1:52am

I'm trying to alter the defaults in the Image gallery page (ie the album width, height, etc). I would like to do so in the config file so that I can upgrade to future versions easily. I believe I can do this through a DataObjectDecorator, but I'm lost on the exact way to do so, and have found little to no documentation. Here is my code this far...

ImageGalleryDecorator

class ImageGalleryDecorator extends DataObjectDecorator {
   static $defaults = array (
      'CoverImageWidth' => '140',
      'CoverImageHeight' => '140'
   );
}

_config.php

DataObject::add_extension("ImageGalleryPage","ImageGalleryDecorator");

Could something like this work? Does anyone have any ideas, or can point me in the right direction? Thanks in advance.

Avatar
UncleCheese

4085 Posts

28 October 2009 at 3:10am

Edited: 28/10/2009 3:11am

You don't need a decorator for that.

_config.php

singleton("ImageGalleryPage")->set_stat('defaults',array(
// etc...
));

If you were to use a decorator, though, you would use:

function extraStatics() {
return array (
'defaults' => array(
// etc..
);
)
}

Avatar
Andrew Houle

Community Member, 132 Posts

28 October 2009 at 3:30am

Ah, that worked, thanks!