Source of file ElementVirtualLinkedController.php
Size: 2,363 Bytes - Last Modified: 2021-12-24T06:44:58+00:00
/var/www/docs.ssmods.com/process/src/src/Control/ElementVirtualLinkedController.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 | <?php namespace DNADesign\ElementalVirtual\Control; use DNADesign\Elemental\Controllers\ElementController; use Exception; class ElementVirtualLinkedController extends ElementController { /** * Returns the current element in scope rendered into its' holder * * @return HTML */ public function ElementHolder() { return $this->renderWith('ElementHolder_VirtualLinked'); } /** * @param string $action * * @return string */ public function Link($action = null) { if ($this->data()->virtualOwner) { $controller = ElementController::create($this->data()->virtualOwner); return $controller->Link($action); } return parent::Link($action); } /** * if this is a virtual request, change the hash if set. * * @param string $url * @param int $code * * @return HTTPResponse */ public function redirect($url, $code = 302) { if ($this->data()->virtualOwner) { $parts = explode('#', $url); if (isset($parts[1])) { $url = $parts[0] . '#' . $this->data()->virtualOwner->ID; } } return parent::redirect($url, $code); } public function __call($method, $arguments) { try { $retVal = parent::__call($method, $arguments); } catch (Exception $e) { $controller = $this->LinkedElement()->getController(); $retVal = call_user_func_array([$controller, $method], $arguments); } return $retVal; } public function hasMethod($action) { if (parent::hasMethod($action)) { return true; } $controller = $this->LinkedElement()->getController(); return $controller->hasMethod($action); } public function hasAction($action) { if (parent::hasAction($action)) { return true; } $controller = $this->LinkedElement()->getController(); return $controller->hasAction($action); } public function checkAccessAction($action) { if (parent::checkAccessAction($action)) { return true; } $controller = $this->LinkedElement()->getController(); return $controller->checkAccessAction($action); } } |