Skip to content

Commit

Permalink
MINOR: Check for a previously created CachedLink before calculating t…
Browse files Browse the repository at this point in the history
…he link. This is set by the children() method in Hierarchy.php, to reduce the number of database queries
  • Loading branch information
gordonbanderson committed Apr 2, 2014
1 parent 3fcfbdb commit 5fdc2f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion code/model/SiteTree.php
Expand Up @@ -464,7 +464,13 @@ static public function link_shortcode_handler($arguments, $content = null, $pars
* @return string
*/
public function Link($action = null) {
return Controller::join_links(Director::baseURL(), $this->RelativeLink($action));
$result = null;
if (isset($this->CachedLink)) {
$result = $this->CachedLink;
} else {
$result = Controller::join_links(Director::baseURL(), $this->RelativeLink($action));
}
return $result;
}

/**
Expand Down

0 comments on commit 5fdc2f1

Please sign in to comment.