Total Complexity | 6 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | class ElementForm extends BaseElement |
||
12 | { |
||
13 | use UserForm; |
||
14 | |||
15 | private static $table_name = 'ElementForm'; |
||
|
|||
16 | |||
17 | private static $icon = 'dnadesign/silverstripe-elemental-userforms:images/form.svg'; |
||
18 | |||
19 | private static $controller_class = ElementFormController::class; |
||
20 | |||
21 | private static $singular_name = 'form'; |
||
22 | |||
23 | private static $plural_name = 'forms'; |
||
24 | |||
25 | /** |
||
26 | * @return UserForm |
||
27 | */ |
||
28 | public function Form() |
||
29 | { |
||
30 | $controller = UserDefinedFormController::create($this); |
||
31 | $current = Controller::curr(); |
||
32 | $controller->setRequest($current->getRequest()); |
||
33 | |||
34 | if ($current && $current->getAction() == 'finished') { |
||
35 | return $controller->renderWith(UserDefinedFormController::class .'_ReceivedFormSubmission'); |
||
36 | } |
||
37 | |||
38 | $form = $controller->Form(); |
||
39 | $form->setFormAction( |
||
40 | Controller::join_links( |
||
41 | $current->Link(), |
||
42 | 'element', |
||
43 | $this->owner->ID, |
||
44 | 'Form' |
||
45 | ) |
||
46 | ); |
||
47 | |||
48 | return $form; |
||
49 | } |
||
50 | |||
51 | public function Link($action = null) |
||
52 | { |
||
53 | $current = Controller::curr(); |
||
54 | |||
55 | if ($action === 'finished') { |
||
56 | return Controller::join_links( |
||
57 | $current->Link(), |
||
58 | 'finished' |
||
59 | ); |
||
60 | } |
||
61 | |||
62 | return parent::Link($action); |
||
63 | } |
||
64 | |||
65 | public function getType() |
||
68 | } |
||
69 | } |
||
70 |
This check marks private properties in classes that are never used. Those properties can be removed.