1 | <?php |
||
3 | namespace Dynamic\DynamicBlocks\Model; |
||
4 | |||
5 | use Dynamic\DynamicBlocks\Block\PromoBlock; |
||
6 | use SilverStripe\Assets\Image; |
||
7 | use SilverStripe\Forms\GridField\GridField; |
||
8 | use SilverStripe\Forms\GridField\GridFieldConfig_RecordViewer; |
||
9 | use SilverStripe\ORM\DataObject; |
||
10 | |||
11 | class PromoObject extends DataObject |
||
12 | { |
||
13 | /** |
||
14 | * @return string |
||
15 | */ |
||
16 | private static $singular_name = 'Promo'; |
||
17 | |||
18 | /** |
||
19 | * @return string |
||
20 | */ |
||
21 | private static $plural_name = 'Promos'; |
||
22 | |||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | private static $db = array( |
||
27 | 'Name' => 'Varchar(255)', |
||
28 | 'Title' => 'Varchar(255)', |
||
29 | 'Content' => 'HTMLText', |
||
30 | ); |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | private static $has_one = array( |
||
36 | 'Image' => Image::class, |
||
37 | //'BlockLink' => 'Link', // todo readd once Linkable is SS4 compatible |
||
|
|||
38 | ); |
||
39 | |||
40 | /** |
||
41 | * @var array |
||
42 | */ |
||
43 | private static $belongs_many_many = array( |
||
44 | 'PromoBlocks' => PromoBlock::class, |
||
45 | ); |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | private static $default_sort = 'Name ASC'; |
||
51 | |||
52 | /** |
||
53 | * @var array |
||
54 | */ |
||
55 | private static $summary_fields = array( |
||
56 | 'Image.CMSThumbnail' => 'Image', |
||
57 | 'Name' => 'Name', |
||
58 | 'Title' => 'Title', |
||
59 | ); |
||
60 | |||
61 | /** |
||
62 | * @var array |
||
63 | */ |
||
64 | private static $searchable_fields = array( |
||
65 | 'Name' => 'Name', |
||
66 | 'Title' => 'Title', |
||
67 | ); |
||
68 | |||
69 | /** |
||
70 | * @return \SilverStripe\Forms\FieldList |
||
71 | 1 | */ |
|
72 | public function getCMSFields() |
||
102 | 1 | ||
103 | /** |
||
104 | 1 | * @return \SilverStripe\ORM\ValidationResult |
|
105 | */ |
||
106 | 1 | public function validate() |
|
116 | |||
117 | /** |
||
118 | * Set permissions, allow all users to access by default. |
||
119 | * Override in descendant classes, or use PermissionProvider. |
||
120 | */ |
||
121 | |||
122 | /** |
||
123 | 1 | * @param null $member |
|
124 | * |
||
125 | 1 | * @return bool |
|
126 | */ |
||
127 | public function canCreate($member = null, $context = []) |
||
131 | |||
132 | /** |
||
133 | 1 | * @param null $member |
|
134 | * |
||
135 | 1 | * @return bool |
|
136 | */ |
||
137 | public function canView($member = null, $context = []) |
||
141 | |||
142 | /** |
||
143 | 1 | * @param null $member |
|
144 | * |
||
145 | 1 | * @return bool |
|
146 | */ |
||
147 | public function canEdit($member = null, $context = []) |
||
151 | |||
152 | /** |
||
153 | 1 | * @param null $member |
|
154 | * |
||
155 | 1 | * @return bool |
|
156 | */ |
||
157 | public function canDelete($member = null, $context = []) |
||
158 | { |
||
161 | } |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.