1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace DNADesign\ElementalVirtual\Control; |
4
|
|
|
|
5
|
|
|
use DNADesign\Elemental\Controllers\ElementController; |
6
|
|
|
use Exception; |
7
|
|
|
|
8
|
|
|
class ElementVirtualLinkedController extends ElementController |
9
|
|
|
{ |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Returns the current element in scope rendered into its' holder |
13
|
|
|
* |
14
|
|
|
* @return HTML |
|
|
|
|
15
|
|
|
*/ |
16
|
|
|
public function ElementHolder() |
17
|
|
|
{ |
18
|
|
|
return $this->renderWith('ElementHolder_VirtualLinked'); |
|
|
|
|
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @param string $action |
23
|
|
|
* |
24
|
|
|
* @return string |
25
|
|
|
*/ |
26
|
|
|
public function Link($action = null) |
27
|
|
|
{ |
28
|
|
|
if ($this->data()->virtualOwner) { |
|
|
|
|
29
|
|
|
$controller = ElementController::create($this->data()->virtualOwner); |
30
|
|
|
|
31
|
|
|
return $controller->Link($action); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
return parent::Link($action); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* if this is a virtual request, change the hash if set. |
39
|
|
|
* |
40
|
|
|
* @param string $url |
41
|
|
|
* @param int $code |
42
|
|
|
* |
43
|
|
|
* @return HTTPResponse |
|
|
|
|
44
|
|
|
*/ |
45
|
|
|
public function redirect($url, $code = 302) |
46
|
|
|
{ |
47
|
|
|
if ($this->data()->virtualOwner) { |
48
|
|
|
$parts = explode('#', $url); |
49
|
|
|
if (isset($parts[1])) { |
50
|
|
|
$url = $parts[0] . '#' . $this->data()->virtualOwner->ID; |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
return parent::redirect($url, $code); |
|
|
|
|
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
|
58
|
|
|
|
59
|
|
|
public function __call($method, $arguments) |
60
|
|
|
{ |
61
|
|
|
try { |
62
|
|
|
$retVal = parent::__call($method, $arguments); |
63
|
|
|
} catch (Exception $e) { |
64
|
|
|
$controller = $this->LinkedElement()->getController(); |
|
|
|
|
65
|
|
|
$retVal = call_user_func_array([$controller, $method], $arguments); |
66
|
|
|
} |
67
|
|
|
return $retVal; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function hasMethod($action) |
71
|
|
|
{ |
72
|
|
|
if (parent::hasMethod($action)) { |
73
|
|
|
return true; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
$controller = $this->LinkedElement()->getController(); |
77
|
|
|
return $controller->hasMethod($action); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function hasAction($action) |
81
|
|
|
{ |
82
|
|
|
if (parent::hasAction($action)) { |
83
|
|
|
return true; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
$controller = $this->LinkedElement()->getController(); |
87
|
|
|
|
88
|
|
|
return $controller->hasAction($action); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public function checkAccessAction($action) |
92
|
|
|
{ |
93
|
|
|
if (parent::checkAccessAction($action)) { |
94
|
|
|
return true; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
$controller = $this->LinkedElement()->getController(); |
98
|
|
|
|
99
|
|
|
return $controller->checkAccessAction($action); |
100
|
|
|
} |
101
|
|
|
} |
102
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths