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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

Overriding/Extending Requirements and Requirements_Backend class


Go to End


3 Posts   966 Views

Avatar
Jatinder

Community Member, 23 Posts

4 January 2012 at 5:38pm

Edited: 04/01/2012 5:38pm

Hello,

Is it possible to override or extend the Requirements and Requirements_Backend classes?

I want to add CDN URL support for loading CSS/JS resources so that I can get the combined CSS/JS files to be pulled from an external CDN URL.

I got this working by modifying the Requirements/Requirements_Backend classes but am looking for a more cleaner solution that does not involve hacking the core files.

Any hints/help on this?

Thanks,
Jatinder Singh Thind

Avatar
(deleted)

Community Member, 473 Posts

4 January 2012 at 7:26pm

You can subclass Requirements_Backend then, in your _config.php or Page_Controller::init(), call Requirements::set_backend(new MyBackend);

Avatar
Jatinder

Community Member, 23 Posts

4 January 2012 at 11:23pm

That worked perfectly. Thanks a lot Simon.