From 0f082bd16057d3b10ccc9d17190c287ce376f7bf Mon Sep 17 00:00:00 2001 From: Sam Georges Date: Tue, 27 May 2014 13:14:02 +1000 Subject: [PATCH] Comment out code until determined if it is needed --- modules/cms/classes/ComponentBase.php | 34 +++++------ modules/cms/classes/Controller.php | 85 ++++++++++++++------------- modules/cms/classes/Router.php | 2 +- 3 files changed, 61 insertions(+), 60 deletions(-) diff --git a/modules/cms/classes/ComponentBase.php b/modules/cms/classes/ComponentBase.php index 807b76cc3..1bf7e700c 100644 --- a/modules/cms/classes/ComponentBase.php +++ b/modules/cms/classes/ComponentBase.php @@ -160,28 +160,28 @@ abstract class ComponentBase extends Extendable * @param array $mappings ['componentProperty' => 'routed value'] * @return string */ - protected function makePageLink($page, $class, $mappings = []) - { - if (!isset($this->pageLinkCache[$page.$class])) { - $this->pageLinkCache[$page.$class] = $this->getOtherPageComponent($page, $class); - } + // protected function makePageLink($page, $class, $mappings = []) + // { + // if (!isset($this->pageLinkCache[$page.$class])) { + // $this->pageLinkCache[$page.$class] = $this->getOtherPageComponent($page, $class); + // } - if (!$component = $this->pageLinkCache[$page.$class]) - return null; + // if (!$component = $this->pageLinkCache[$page.$class]) + // return null; - $params = []; - foreach ($mappings as $property => $value) { + // $params = []; + // foreach ($mappings as $property => $value) { - if (!$param = $component->property($property)) - continue; + // if (!$param = $component->property($property)) + // continue; - if (substr($param, 0, 1) == ':') - $param = substr($param, 1); + // if (substr($param, 0, 1) == ':') + // $param = substr($param, 1); - $params[$param] = $value; - } + // $params[$param] = $value; + // } - return $this->pageUrl($page, $params); - } + // return $this->pageUrl($page, $params); + // } } \ No newline at end of file diff --git a/modules/cms/classes/Controller.php b/modules/cms/classes/Controller.php index c20de34b2..156f18534 100644 --- a/modules/cms/classes/Controller.php +++ b/modules/cms/classes/Controller.php @@ -278,48 +278,6 @@ class Controller extends BaseController return $componentObj; } - /** - * Creates a basic component object for another page, useful for extracting properties. - * @param string $page Page name or page file name - * @param string $class Component class name - * @return ComponentBase - */ - public function getOtherPageComponent($page, $class) - { - $class = Str::normalizeClassName($class); - $theme = $this->getTheme(); - $manager = ComponentManager::instance(); - $componentObj = new $class; - - if (($page = Page::loadCached($theme, $page)) && isset($page->settings['components'])) { - foreach ($page->settings['components'] as $component => $properties) { - list($name, $alias) = strpos($component, ' ') ? explode(' ', $component) : array($component, $component); - if ($manager->resolve($name) == $class) { - $componentObj->setProperties($properties); - $componentObj->alias = $alias; - return $componentObj; - } - } - - if (!isset($page->settings['layout'])) - return null; - - $layout = $page->settings['layout']; - if (($layout = Layout::loadCached($theme, $layout)) && isset($layout->settings['components'])) { - foreach ($layout->settings['components'] as $component => $properties) { - list($name, $alias) = strpos($component, ' ') ? explode(' ', $component) : array($component, $component); - if ($manager->resolve($name) == $class) { - $componentObj->setProperties($properties); - $componentObj->alias = $alias; - return $componentObj; - } - } - } - } - - return null; - } - /** * Executes the page, layout, component and plugin AJAX handlers. * @return mixed Returns the AJAX Response object or null. @@ -779,4 +737,47 @@ class Controller extends BaseController return null; } + + /** + * Creates a basic component object for another page, useful for extracting properties. + * @param string $page Page name or page file name + * @param string $class Component class name + * @return ComponentBase + */ + // public function getOtherPageComponent($page, $class) + // { + // $class = Str::normalizeClassName($class); + // $theme = $this->getTheme(); + // $manager = ComponentManager::instance(); + // $componentObj = new $class; + + // if (($page = Page::loadCached($theme, $page)) && isset($page->settings['components'])) { + // foreach ($page->settings['components'] as $component => $properties) { + // list($name, $alias) = strpos($component, ' ') ? explode(' ', $component) : array($component, $component); + // if ($manager->resolve($name) == $class) { + // $componentObj->setProperties($properties); + // $componentObj->alias = $alias; + // return $componentObj; + // } + // } + + // if (!isset($page->settings['layout'])) + // return null; + + // $layout = $page->settings['layout']; + // if (($layout = Layout::loadCached($theme, $layout)) && isset($layout->settings['components'])) { + // foreach ($layout->settings['components'] as $component => $properties) { + // list($name, $alias) = strpos($component, ' ') ? explode(' ', $component) : array($component, $component); + // if ($manager->resolve($name) == $class) { + // $componentObj->setProperties($properties); + // $componentObj->alias = $alias; + // return $componentObj; + // } + // } + // } + // } + + // return null; + // } + } \ No newline at end of file diff --git a/modules/cms/classes/Router.php b/modules/cms/classes/Router.php index c37d88d51..0499ce891 100644 --- a/modules/cms/classes/Router.php +++ b/modules/cms/classes/Router.php @@ -136,7 +136,7 @@ class Router * @param array $parameters Route parameters to consider in the URL. * @return string A built URL matching the page route. */ - public function findByFile($fileName, $parameters = []) + public function findByFile($fileName, $parameters = []) { if (!strlen(File::extension($fileName))) $fileName .= '.htm';