public function getCMSFields() { $fields = parent::getCMSFields(); // Set some fields $fields->addFieldToTab('Root.Main', new TextField('Location')); $fields->addFieldToTab('Root.Main', new TextField('CapturedBy')); // Configure the date field $df = new DateField('DateCaptured', 'Date Captured (dd/mm/yyyy)'); $df->setLocale('en_NZ'); $df->setConfig('dateformat', 'dd/MM/YYYY'); $df->setConfig('showcalendar', 'true'); $fields->addFieldToTab('Root.Main', $df); return $fields; }
public function getCMSFields() { $fields = new FieldList(); $fields->push(new LiteralField("Title", "<h2>Schedule Time</h2>")); $start_date = new DateField("StartDate", "Start Date"); $start_date->setLocale('en_US'); $start_date->setConfig('showcalendar', true); $fields->push($start_date); $end_date = new DateField("EndDate", "End Date"); $end_date->setLocale('en_US'); $end_date->setConfig('showcalendar', true); $fields->push($end_date); $fields->push(new TextField("Link", "Link")); $fields->push(new HiddenField("LocationID", "Location")); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $group = new FieldGroup(); $group->setTitle(_t('News.Author')); $group->setDescription(_t('News.AuthorPage')); $fields->addFieldToTab('Root.Main', $group, 'Metadata'); $field = new TextField('AuthorName', _t('News.Name')); $group->push($field); $field = new TextField('AuthorURI', _t('News.URI')); $group->push($field); $field = new TextField('AuthorEmail', _t('News.Email')); $group->push($field); $field = new DateField('Published', _t('News.Published')); $field->setDescription(_t('News.PublishedDescription')); $field->setLocale($this->config()->date_locale); $field->setConfig('dateformat', $this->config()->date_format); $field->setConfig('showcalendar', true); $fields->addFieldToTab('Root.Main', $field, 'Content'); $field = new HtmlEditorField('Summary', _t('News.Summary')); $field->setRows(4); $fields->addFieldToTab('Root.Main', $field, 'Content'); return $fields; }
function setLocale($locale) { $this->dateField->setLocale($locale); $this->timeField->setLocale($locale); }
public function testSetLocale() { // should get en_NZ by default through setUp() $f = new DateField('Date', 'Date', '29/03/2003'); $f->setLocale('de_DE'); $f->setValue('29.06.2006'); $this->assertEquals($f->dataValue(), '2006-06-29'); }
public function setLocale($locale) { $this->dateField->setLocale($locale); $this->timeField->setLocale($locale); return $this; }