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

Removing requirements from Basic-Galleries without editing modules directly


Reply


2 Posts   368 Views

Avatar
Avalon

Community Member, 6 Posts

10 November 2013 at 5:45pm

Edited: 10/11/2013 5:51pm

Running SilverStripe 3.1.1.

I am trying to remove the CSS requirement for PhotoGalleryHolder pages so then I don't have extra CSS files downloading that I don't even use in my overridden templates.

This is what I am currently using, but doesn't seem to work:

mysite/code/PhotoGalleryHolder.php:

class PhotoGalleryHolderController_Extension extends Extension {
   public function init() {
      Requirements::block("basic-galleries/css/gallery.css");
   }
}

mysite/_config.php:

PhotoGalleryHolder_Controller::add_extension('PhotoGalleryHolderController_Extension');

Avatar
Nivanka

Community Member, 400 Posts

3 December 2013 at 5:32am

Edited: 03/12/2013 5:32am

you have to use onAfterInit function

class PhotoGalleryHolderController_Extension extends Extension {

public function onAfterInit () {
Requirements::clear("basic-galleries/css/gallery.css");
}
}