1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SilverStripe\AssetAdmin\Forms; |
4
|
|
|
|
5
|
|
|
use SilverStripe\Assets\File; |
6
|
|
|
use SilverStripe\Control\Controller; |
7
|
|
|
use SilverStripe\Forms\FieldList; |
8
|
|
|
use SilverStripe\Forms\LiteralField; |
9
|
|
|
use SilverStripe\Forms\ReadonlyField; |
10
|
|
|
|
11
|
|
|
class FileHistoryFormFactory extends FileFormFactory |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
protected function getFormFields(Controller $controller, $name, $context = []) |
15
|
|
|
{ |
16
|
|
|
$record = $context['Record']; |
17
|
|
|
|
18
|
|
|
$fields = new FieldList( |
19
|
|
|
LiteralField::create('Thumbnail', $this->getIconMarkup($record)), |
20
|
|
|
LiteralField::create('FileSpecs', $this->getSpecsMarkup($record)), |
21
|
|
|
ReadonlyField::create("Title", File::singleton()->fieldLabel('Title')), |
22
|
|
|
ReadonlyField::create('Name', File::singleton()->fieldLabel('Filename')), |
23
|
|
|
ReadonlyField::create("Path", _t('AssetTableField.PATH', 'Path'), $this->getPath($record)) |
24
|
|
|
); |
25
|
|
|
|
26
|
|
|
$this->invokeWithExtensions('updateFormFields', $fields, $controller, $name, $context); |
27
|
|
|
|
28
|
|
|
return $fields; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
|
32
|
|
|
protected function getFormActions(Controller $controller, $name, $context = []) |
33
|
|
|
{ |
34
|
|
|
$record = $context['Record']; |
|
|
|
|
35
|
|
|
|
36
|
|
|
$actions = new FieldList(); |
37
|
|
|
|
38
|
|
|
// Update |
39
|
|
|
$this->invokeWithExtensions('updateFormActions', $actions, $controller, $name, $context); |
40
|
|
|
|
41
|
|
|
return $actions; |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
|
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.