1 <?php
2 3 4 5 6 7 8
9 class PriceListWidget extends SidebarWidget {
10
11 static $db = array(
12 'Price1Title' => 'Varchar',
13 'Price2Title' => 'Varchar',
14 'Price3Title' => 'Varchar',
15 );
16
17 static $has_one = array(
18 'Price1' => 'File',
19 'Price2' => 'File',
20 'Price3' => 'File',
21 );
22
23 function getCMSFields() {
24 $fields = parent::getCMSFields();
25
26 $fields->addFieldToTab('Root.Main', $fields->dataFieldByName('Price1'), 'Price2Title');
27 $fields->addFieldToTab('Root.Main', $fields->dataFieldByName('Price2'), 'Price3Title');
28 return $fields;
29 }
30
31 function hasContent() {
32 if ($this->Price1ID && $this->Price1()) {
33 return true;
34 }
35 if ($this->Price2ID && $this->Price2()) {
36 return true;
37 }
38 if ($this->Price3ID && $this->Price3()) {
39 return true;
40 }
41 return false;
42 }
43 }
44
45
[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.
-