1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?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'))
        );
        
    }
    
}