16/10/2013 10:17am

PHP | Problem -


<?php

class Gallery extends Page {

private static $singular_name = 'Gallery';
private static $plural_name = 'Galleries';
private static $description = 'A Gallery with multiple images, needs a Holder';

private static $can_be_root = false;
private static $allowed_children = array('');
private static $default_child = '';

private static $icon = 'mysite/icons/gallery_icon.png';

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

private static $db = array(
'UseLightBox' => 'Text'
);

private static $has_one = array(

);

private static $has_many = array(
'GalleryImages' => 'VisualObject'
);

private static $many_many = array(

);

private static $defaults = array(
'UseLightBox' => 'true',
'ShowSlider' => 'false'
);

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

public function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab('Root', new Tab('Images', _t('Dict.GALLERY_IMAGES', 'Gallery Images')));

$lightBox = new DropdownField(
'UseLightBox',
_t('Dict.USE_LIGHT_BOX', 'Use Lightbox for all Images in this Gallery?'),
array(
'true' => _t('Dict.YES', 'Yes'),
'false' => _t('Dict.NO', 'No')
)
);

$fields->addFieldsToTab('Root.Images', $lightBox, '');

$galleryObjectField = new GridField('GalleryImages', 'Gallery Images', $this->GalleryImages(), CreateSortableGrid::create());
$fields->addFieldToTab('Root.Images', $galleryObjectField);

return $fields;
}

}

class Gallery_Controller extends Page_Controller {

}

?>


Post Comment