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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

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

Event Calendar upgrade, extended CalendarDateTime field disappears


Go to End


3 Posts   1579 Views

Avatar
toddm

Community Member, 15 Posts

31 August 2009 at 8:26am

Hi,

I recently upgrade SS to 2.3.3 and then pulled down the latest Event Calendar code from SVN. I had some extension classes working nicely, but now there are issues.

In particular, how do I get my custom field to show up in the Date popup?

Example:

<?php
class CourseOrEventDateTime extends CalendarDateTime
{
  static $db = array (
   'Location' => 'Varchar(50)'
   );
 
   static $has_one = array (
    'CourseOrEvent' => 'CourseOrEvent'
   );
   
	public function extendTable()
	{
	 $this->addTableTitles(array(
	   'Location' => 'Location'
	 ));
	 $this->addTableFields(array(
	   'Location' => 'TextField'
	 ));
	}
}
?>

How do I get "Location" to appear in the pop-up?

Todd

Avatar
toddm

Community Member, 15 Posts

31 August 2009 at 8:48am

Edited: 31/08/2009 8:48am

Wouldn't you know it, right after I post I find a "solution". Or is the following a hack?

	public function extendTable()
	{
	 $this->addTableTitles(array(
	   'Location' => 'Location'
	 ));
	 $this->addTableFields(array(
	   'Location' => 'TextField'
	 ));
	 $newpopup = new TextField('Location');
	 $this->addPopupField($newpopup);
	}

Avatar
UncleCheese

Forum Moderator, 4102 Posts

31 August 2009 at 10:31am

Yeah, the addTableField() method is somewhat deprecated. I eventually want EventCalendar to require DataObjectManager, making the old TableFields useless. So what you did is correct. addPopupField() and addPopupFields() are what you should be using.