public function getFrontEndFields($params = null)
    {
        //parent::getFrontEndFields($params);

        $timeFrameHeaderText = 'Time Frame';
        if (!CalendarConfig::subpackage_setting('events', 'force_end')) {
            $timeFrameHeaderText = 'End Date / Time (optional)';
        }


        $fields = FieldList::create(
            TextField::create('Title')
                ->setAttribute('placeholder', 'Enter a title'),
            CheckboxField::create('AllDay', 'All-day'),
            $startDateTime = DatetimeField::create('StartDateTime', 'Start'),
            //NoEnd field - will only be shown if end dates are not enforced - see below
            CheckboxField::create('NoEnd', 'Open End'),
            HeaderField::create('TimeFrameHeader', $timeFrameHeaderText, 5),
            //LiteralField::create('TimeFrameText','<em class="TimeFrameText">Choose the type of time frame you\'d like to enter</em>'),
            SelectionGroup::create('TimeFrameType', array(
                "Duration//Duration" => TimeField::create('Duration', '')->setRightTitle('up to 24h')
                    ->setAttribute('placeholder', 'Enter duration'),
                "DateTime//Date/Time" => $endDateTime = DateTimeField::create('EndDateTime', '')
                )
            ),
            LiteralField::create('Clear', '<div class="clear"></div>')
        );

        //Date field settings
        $timeExpl = 'Time, e.g. 11:15am or 15:30';

        //$startDateTime->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm');
        //$endDateTime->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm');


        $startDateTime->getDateField()
            ->setConfig('showcalendar', 1)
            //->setRightTitle('Date')
            ->setAttribute('placeholder', 'Enter date')
            ->setAttribute('readonly', 'true'); //we only want input through the datepicker
        $startDateTime->getTimeField()
            //->setRightTitle($timeExpl)
            //->setConfig('timeformat', 'h:mm') //this is the default, that seems to be giving some troubles: h:mm:ss a
            ->setConfig('timeformat', 'HH:mm') //24h format
            ->setAttribute('placeholder', 'Enter time');

        $endDateTime->getDateField()
            ->setConfig('showcalendar', 1)
            //->setRightTitle('Date')
            ->setAttribute('placeholder', 'Enter date')
            ->setAttribute('readonly', 'true'); //we only want input through the datepicker
        $endDateTime->getTimeField()
            //->setRightTitle($timeExpl)
            ->setConfig('timeformat', 'HH:mm') //24h fromat
            ->setAttribute('placeholder', 'Enter time');

        //removing AllDay checkbox if allday events are disabled
        if (!CalendarConfig::subpackage_setting('events', 'enable_allday_events')) {
            $fields->removeByName('AllDay');
        }
        //removing NoEnd checkbox if end dates are enforced
        if (CalendarConfig::subpackage_setting('events', 'force_end')) {
            $fields->removeByName('NoEnd');
        } else {
            //we don't want the NoEnd checkbox when creating new events
            if (!$this->ID) {
                //$fields->removeByName('NoEnd');
            }
        }


        $this->extend('updateFrontEndFields', $fields);
        return $fields;
    }