<?php

class SliderObject extends DataObject {

static public $db = array(
'SortID' => 'Int',
'Title' => 'Text',
'Link' => 'Text',
'Description' => 'Text'
);

static public $has_one = array(
'Visual' => 'Image',
'Page' => 'Page'
);

static $summary_fields = array(
'Visual.CMSThumbnail',
'Title',
'Link',
'Description'
);

public static $default_sort = 'SortID Asc';

public function fieldLabels($_includerelations = true) {

$_labels = parent::fieldLabels($_includerelations);
$_labels['Visual.CMSThumbnail'] = _t('Dict.VISUAL', 'Slider Bild');
$_labels['Title'] = _t('Dict.TITLE', 'Titel');
$_labels['Link'] = _t('Dict.LINK', 'Link');
$_labels['Description'] = _t('Dict.DESCRIPTION', 'Beschreibung des Bilds');
return $_labels;
}

public function getCMSFields() {

$_visual = new UploadField('Visual', _t('Dict.VISUAL', 'Slider Bild'));
$_visual->setFolderName('Slider');

return new FieldList(
new TextField('Title', _t('Dict.TITLE', 'Titel')),
new TextField('Link', _t('Dict.LINK', 'Link')),
$_visual,
new TextareaField('Description', _t('Dict.DESCRIPTION', 'Zusätzliche Info oder Beschreibung'))
);

}

}