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.

Customising the CMS /

Overriding/Extending Requirements and Requirements_Backend class


Reply


3 Posts   552 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
simon_w

Forum Moderator, 474 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.