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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

Overriding/Extending Requirements and Requirements_Backend class


Go to End


3 Posts   1368 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.