These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | class DMSDocumentAddExistingField extends CompositeField |
||
4 | { |
||
5 | public $useFieldContext = true; |
||
6 | |||
7 | public function __construct($name, $title = null) |
||
8 | { |
||
9 | $this->name = $name; |
||
10 | $this->title = ($title === null) ? $name : $title; |
||
11 | |||
12 | parent::__construct( |
||
13 | new TreeDropdownField( |
||
14 | 'PageSelector', |
||
15 | 'Add from another page', |
||
16 | 'SiteTree', |
||
17 | 'ID', |
||
18 | 'TitleWithNumberOfDocuments' |
||
19 | ) |
||
20 | ); |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Force a record to be used as "Parent" for uploaded Files (eg a Page with a has_one to File) |
||
25 | * @param DataObject $record |
||
26 | */ |
||
27 | public function setRecord($record) |
||
28 | { |
||
29 | $this->record = $record; |
||
30 | return $this; |
||
31 | } |
||
32 | /** |
||
33 | * Get the record to use as "Parent" for uploaded Files (eg a Page with a has_one to File) If none is set, it |
||
34 | * will use Form->getRecord() or Form->Controller()->data() |
||
35 | * @return DataObject |
||
36 | */ |
||
37 | public function getRecord() |
||
38 | { |
||
39 | if (!$this->record && $this->form) { |
||
40 | if ($this->form->getRecord() && is_a($this->form->getRecord(), 'DataObject')) { |
||
41 | $this->record = $this->form->getRecord(); |
||
42 | } elseif ($this->form->Controller() && $this->form->Controller()->hasMethod('data') |
||
0 ignored issues
–
show
|
|||
43 | && $this->form->Controller()->data() && is_a($this->form->Controller()->data(), 'DataObject')) { |
||
0 ignored issues
–
show
The method
Form::Controller() has been deprecated with message: 4.0
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.
Loading history...
|
|||
44 | $this->record = $this->form->Controller()->data(); |
||
0 ignored issues
–
show
The method
Form::Controller() has been deprecated with message: 4.0
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.
Loading history...
|
|||
45 | } |
||
46 | } |
||
47 | return $this->record; |
||
48 | } |
||
49 | |||
50 | public function FieldHolder($properties = array()) |
||
51 | { |
||
52 | return $this->Field($properties); |
||
53 | } |
||
54 | |||
55 | public function Field($properties = array()) |
||
56 | { |
||
57 | Requirements::javascript(DMS_DIR.'/javascript/DMSDocumentAddExistingField.js'); |
||
58 | Requirements::javascript(DMS_DIR."/javascript/DocumentHtmlEditorFieldToolbar.js"); |
||
59 | |||
60 | return $this->renderWith('DMSDocumentAddExistingField'); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Sets or unsets the use of the "field" class in the template. The "field" class adds Javascript behaviour |
||
65 | * that causes unwelcome hiding side-effects when this Field is used within the link editor pop-up |
||
66 | * |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function setUseFieldClass($use = false) |
||
70 | { |
||
71 | $this->useFieldContext = $use; |
||
72 | return $this; |
||
73 | } |
||
74 | } |
||
75 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.