I'm trying to format the date into 'HasOneComplexTableField' and 'FieldSet'. I only try to put the date in the right format in the CMS.
For the fieldset i've got this code:
function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push( new DateField( 'Date', 'Datum') ); //<-- This date has to be formatted into dd-MM-YYYY
$fields->push( new TextareaField( 'ShortDesc', 'Korte beschrijving' ) );
$fields->push( new TextareaField( 'LongDesc', 'Lange Beschrijving' ) );
return $fields;
}
For the 'HasOneComplexTableField' i've got this code:
$tablefield = new HasOneComplexTableField(
$this,
'MyCalendar',
'Calendar',
array(
'Date' => 'Datum',//<-- This date has to be formatted into dd-MM-YYYY
'ShortDesc' => 'Korte beschrijving',
'LongDesc' => 'Lange beschrijving'
),
'getCMSFields_forPopup'
);
In my __config.php i did setup the i18n settings:
// Set the site locale
i18n::enable();
i18n::set_locale('nl_NL');
i18n::set_date_format('dd-MM-YYYY');
I tried several things, like $fields->setConfig, but it returns the method 'setconfig' does not exist on 'FieldSet'. Is there any regular way to format these fields right?