Total Complexity | 6 |
Total Lines | 56 |
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 ElementForm() |
||
29 | { |
||
30 | $controller = new UserDefinedFormController($this); |
||
31 | $current = Controller::curr(); |
||
32 | |||
33 | if ($current && $current->getAction() == 'finished') { |
||
34 | return $controller->renderWith(UserDefinedFormController::class .'_ReceivedFormSubmission'); |
||
35 | } |
||
36 | |||
37 | $form = $controller->Form(); |
||
38 | $form->setFormAction( |
||
39 | Controller::join_links( |
||
40 | $current->Link(), |
||
41 | 'element', |
||
42 | $this->owner->ID, |
||
43 | 'Form' |
||
44 | ) |
||
45 | ); |
||
46 | |||
47 | return $form; |
||
48 | } |
||
49 | |||
50 | public function Link($action = null) |
||
51 | { |
||
52 | $current = Controller::curr(); |
||
53 | |||
54 | if ($action === 'finished') { |
||
55 | return Controller::join_links( |
||
56 | $current->Link(), |
||
57 | 'finished' |
||
58 | ); |
||
59 | } |
||
60 | |||
61 | return parent::Link($action); |
||
62 | } |
||
63 | |||
64 | public function getType() |
||
67 | } |
||
68 | } |
||
69 |
This check marks private properties in classes that are never used. Those properties can be removed.