本文整理汇总了PHP中DateTimeField::create方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeField::create方法的具体用法?PHP DateTimeField::create怎么用?PHP DateTimeField::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeField
的用法示例。
在下文中一共展示了DateTimeField::create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFrontEndFields
/**
* Frontend fields
* Simple list of the basic fields - how they're intended to be edited
*/
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'), CheckboxField::create('NoEnd', 'Open End'), HeaderField::create('TimeFrameHeader', $timeFrameHeaderText, 5), 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)->setAttribute('placeholder', 'Enter date')->setAttribute('readonly', 'true');
//we only want input through the datepicker
$startDateTime->getTimeField()->setConfig('timeformat', 'HH:mm')->setAttribute('placeholder', 'Enter time');
$endDateTime->getDateField()->setConfig('showcalendar', 1)->setAttribute('placeholder', 'Enter date')->setAttribute('readonly', 'true');
//we only want input through the datepicker
$endDateTime->getTimeField()->setConfig('timeformat', 'HH:mm')->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;
}