Jump to:

10994 Posts in 2728 Topics by 1819 members

All other Modules

SilverStripe Forums » All other Modules » Customizing the Default Array for Image Gallery in the Config

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 784 Views
  • Andrew Houle
    Avatar
    Community Member
    132 Posts

    Customizing the Default Array for Image Gallery in the Config Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Customizing the Default Array for Image Gallery in the Config Link to this post

    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..
    );
    )
    }

  • Andrew Houle
    Avatar
    Community Member
    132 Posts

    Re: Customizing the Default Array for Image Gallery in the Config Link to this post

    Ah, that worked, thanks!

    784 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.