1 | <?php |
||
3 | namespace Dynamic\DynamicBlocks\ORM; |
||
4 | |||
5 | use SilverStripe\AssetAdmin\Forms\UploadField; |
||
6 | use SilverStripe\Assets\Image; |
||
7 | use SilverStripe\Forms\FieldList; |
||
8 | use SilverStripe\Forms\TextField; |
||
9 | use SilverStripe\ORM\DataExtension; |
||
10 | |||
11 | class DynamicContentBlockDataExtension extends DataExtension |
||
12 | { |
||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | private static $db = array( |
||
17 | 'SubTitle' => 'Varchar(255)', |
||
18 | ); |
||
19 | |||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | 1 | private static $has_one = array( |
|
24 | 'Image' => Image::class, |
||
25 | 1 | //'BlockLink' => 'Link', // todo readd once Linkable is SS4 compatible |
|
|
|||
26 | 1 | ); |
|
27 | 1 | ||
28 | /** |
||
29 | 1 | * @param FieldList $fields |
|
30 | 1 | */ |
|
31 | 1 | public function updateCMSFields(FieldList $fields) |
|
32 | { |
||
33 | 1 | $image = UploadField::create('Image') |
|
34 | //->setFolderName('Uploads/Blocks/Content') |
||
35 | 1 | ; |
|
36 | 1 | $fields->insertBefore($image, 'Content'); |
|
37 | |||
38 | /* // todo readd once Linkable is SS4 compatible |
||
39 | $fields->addFieldToTab( |
||
49 | } |
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.