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.

Archive /

Our old forums are still available as a read-only archive.

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

Where to put requirements for CMS


Go to End


2 Posts   1680 Views

Avatar
xmedeko

Community Member, 94 Posts

7 June 2007 at 10:46am

Hi,

I am extending a functionality of CMS and I need to add my javascript and CSS. I use:

Requirements::css(project()."/css/XELayoutEditor.css");
Requirements::javascript(project()."/javascript/XELayoutEditor.js");

When I put it into getCMSFields(), or Controller::init(), or wherever else inside my class, then they are not loaded by default. I have to click on my page, then reload CMS. I can put Requirements to _config.php, but then they will be loaded even when the user will be browsing the final pages. I want to load them only when the admin CMS is open.

Is the only proper place CMSMain::init()?

cheers
andrew

Avatar
Sean

Forum Moderator, 922 Posts

7 June 2007 at 1:57pm

There's a limitation with the system, and you have to add them in CMSMain as you said.

Cheers,
Sean