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

How does Silverstripe work?


Go to End


10 Posts   2089 Views

Avatar
simples

Community Member, 77 Posts

4 June 2013 at 6:03pm

Thanks, that is very helpful.

Even though I am using 2.4 and not 3.0 I will look at http://doc.silverstripe.org/framework/en/reference/dataextension for guidance on how to implement this in 2.4.

Obviously, please let me know if I have misunderstood.

Avatar
simples

Community Member, 77 Posts

5 June 2013 at 12:57am

Edited: 05/06/2013 1:26am

I think I have now finally got there.

I am using 2.4 and this is what I did.

Created the file module_calendar\code\CalendarEventExtension.php.

Placed in this file the following code.

class CalendarEventExtension extends DataObjectDecorator {

    function returnCalendarEvents(){
        .......
        return $object_set;
    }

}

Added the following line to module_calendar\_config.php

#Object::add_extension('SiteTree', 'CalendarEventExtension');

(Note that this line is commented out)

Ran the following command to build the database

dev/build?flush=all

Uncommented the line in module_calendar\_config.php

Job done!!

On browsing the homepage of my site, calendar events now appear in the calendar area.

Although I may still not be doing things correctly, data now appears to be retrieved using code in my module which is totally segregated from other modules.

Unfortunately it has taken me several weeks to reach this point. On a brighter note this is something which I suspect I will be using a lot (if I have done things correctly) so this may be a very big milestone for me.

Go to Top