16/10/2013 10:18am

PHP | Problem -


<?php

class VisualObject extends DataObject {

private static $singular_name = 'Visual';
private static $plural_name = 'Visuals';

//////////////////////////////////////////////

private static $db = array(
'SortID' => 'Int',
'Title' => 'Text',
'Description' => 'HTMLText',
'Visibility' => 'Text'
);

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

private static $summary_fields = array(
'Visual.CMSThumbnail',
'Title',
'Visibility'
);

private static $field_labels = array(
'Visual.CMSThumbnail' => 'Preview',
'Title' => 'Title',
'Visibility' => 'Is Shown'
);

//////////////////////////////////////////////

private static $defaults = array(
'Visibility' => 'true',
);

private static $default_sort='SortID ASC';

//////////////////////////////////////////////

public function getCMSFields() {
$visual = new UploadField('Visual', _t('Dict.IMAGE', 'Image'));
$visual->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
$visual->setFolderName('Gallerie');

$visibility = new DropdownField(
'Visibility',
_t('Dict.VISIBILITY', 'Visible?'),
array(
'true' => _t('Dict.YES', 'Yes'),
'false' => _t('Dict.NO', 'No')
)
);

return new FieldList(
new HeaderField(_t('Dict.ADD_SLIDE', 'Add Slide')),
new LiteralField ('Details', _t('Dict.SLIDE_DETAILS', '<div class="admin-literal-field">Upload an image which will be shown in the Slider<br>Dimensions: 000 px x 000 px</div>')),
$visual,
new TextField('Title', _t('Dict.TITLE', 'Title')),
new HTMLEditorField('Description', _t('Dict.DESCRIPTION', 'Description')),
$visibility
);

}
}


Post Comment