1 <?php
2
3 class PhotoGalleryHomepageWidget extends HomepageWidget {
4
5 static $db = array(
6 'Text' => 'HTMLText',
7 );
8
9 static $has_many = array(
10 'Items' => 'PhotoGalleryHomepageWidget_Item',
11 );
12
13 function getCMSFields() {
14 if (!$this->canCreate()) {
15 return $this->getFailCMSFields();
16 }
17
18 $fields = parent::getCMSFields();
19 $dom = new ImageDataObjectManager(
20 $this,
21 'Items',
22 'PhotoGalleryHomepageWidget_Item',
23 null,
24 null,
25 "getCMSFields_forPopup"
26 );
27 $dom->setRelationAutoSetting(true);
28 $fields->replaceField('Items', $dom);
29
30 return $fields;
31 }
32
33 function Photos() {
34 return $this->Items();
35 }
36 }
37
38 class PhotoGalleryHomepageWidget_Item extends WebylonWidget_Item {
39
40 static $has_one = array(
41 'Image' => 'Image',
42 );
43
44 function getCMSFields() {
45 $fields = parent::getCMSFields();
46 $fields->removeByName('LinkType');
47 $fields->removeByName('ExternalLink');
48 $fields->removeByName('NewWindow');
49
50 return $fields;
51 }
52
53 public function () {
54 $fields = new FieldSet();
55 $fields->push(new CheckboxField('Active', $this->fieldLabel('Active')));
56 $fields->push(new TextField('Title', $this->fieldLabel('Title')));
57
58 return $fields;
59 }
60 }
61
62
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-