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.

All other Modules /

Discuss all other Modules here.

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

Event Module: removeStartFields and removeEndFields not working correctly


Go to End


4530 Views

Avatar
dfondente

Community Member, 15 Posts

9 August 2009 at 10:23am

I want to remove the start and end date selectors on the calendar widget. In my subclass of Calendar, I have put the following in getFilterFields():

		$fields = parent::getFilterFields(); // returns a CalendarFilterFieldSet
		// remove the date filters
		$fields->removeStartFields();
		$fields->removeEndFields();

This removes most of the date selectors, but leaves the end date month in the widget. I looked in the source of event_calendar/code/CalendarFilterFieldSet.php and discovered a typo on line 61 in the function definition for removeEndFields(). I fixed this, and the date selectors are now gone from the widget. However, the form still submits empty dates for start and end date, which results in the filters not returning the correct values. When I submit the widget's form, the URL contains '/--/--', so no events show up at all.

Any suggestions about the best way to resolve this? I could filter '/--/--' out of the URL, but this seems like a bug to me and better to fix in the event calendar module.