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.

Data Model Questions /

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

Event_calendar and "show in menu"


Go to End


3 Posts   1745 Views

Avatar
martbarr

Community Member, 59 Posts

3 July 2010 at 8:34am

Edited: 03/07/2010 8:35am

Hi,
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?

thanks
Martin

Avatar
martbarr

Community Member, 59 Posts

4 July 2010 at 9:54am

Edited: 04/07/2010 9:56am

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

changed line 159 of calendar.php from

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

to
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 .................

cheers
Martin

Avatar
digibrains

Community Member, 130 Posts

2 December 2010 at 7:10am

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.

Chris.b