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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

SS3 - Requirements - Custom frontend methods...


Go to End


2 Posts   879 Views

Avatar
fyrebase

Community Member, 7 Posts

31 October 2012 at 9:24pm

I would like to add some custom methods to Requirements for use in templates without hacking into the original Requirements.php source.

For example:

<% require mymethod(...) %>

It is easy enough to extend the Requirements backend but not so much the frontend. Any help is much appreciated.

Avatar
fyrebase

Community Member, 7 Posts

1 November 2012 at 2:14am

The best solution I came up with was to rename Requirements to Requirements_Frontend and call my custom frontend class Requirements and have it extend Requirements_Frontend. This way only a minimal code change is required in the original source.