Jump to:

3459 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Event_calendar and "show in menu"

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

Page: 1
Go to End
Author Topic: 1151 Views
  • martbarr
    Community Member
    46 Posts

    Event_calendar and "show in menu" Link to this post

    I'm trying to have my calendar show in top menu but not the calendar_events in the tree below it.
    by unchecking "show in menu".
    But this also stops the events from showing at all in the events list.

    Is there an easy way to fix this?

    Am digging round the event_calender code and getting into dataobject::get filters etc
    but surely this is a simple thing to do - why does unchecking "show in menu" also hide the events in my event list?
    and anyone got a fix?


  • martbarr
    Community Member
    46 Posts

    Re: Event_calendar and "show in menu" Link to this post

    well - have a workaround by altering a core file in event_calendar

    changed line 159 of calendar.php from

       if($children = $this->Children()) {

       if($children = $this->AllChildren()) {

    and now I get all events showing in my calendar even when "show in menu" is off.

    but would love a better solution .................


  • prawnstar
    Community Member
    116 Posts

    Re: Event_calendar and "show in menu" Link to this post

    I just came across this problem as well. And while I don't think this is an elegant solution, I think it's better than hacking the core event_calendar code.

    In my template.ss file I use:

    <% if CalendarEvent %>
    ...do nothing...
    <% else %>
    <% control Children %>
    ...some code...
    <% end_control %>
    <% end_if %>

    IMHO - I think of this as a template hack to fix a code logic issue. But at least it keeps the code from being hacked. It doesn't seem logical that events would be forced to show in the navigation. Like the blog module, the events should show up in the events holder without cluttering up the navigation.


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.