Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Move the rendering of HTML link elements to JDocumentRendererHead. #13

Merged
merged 1 commit into from

3 participants

@realityking
Collaborator

Previously discussed here: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=25251

Note: This has some small backwards compatibility consequences (e.g. if somebody chose to override either of the two classes involved) but it makes JDocument more consistent and opens up future use (head links in other types of documents).

@LouisLandry

So the BC stuff is noted, but that is one really good example of the juice being worth the squeeze. Thanks for this one.

@LouisLandry LouisLandry merged commit 70e3914 into joomla:master
@elinw

Was it discussed somewhere on some list that we would post/document about BC breakage when we know about it? Maybe start a wiki page if we don't have one already.

@realityking
Collaborator

Started one: http://docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_1.7_and_Joomla_Platform_11.1

Not sure about the formatting, but at least we won't loose stuff this way.

@elinw

Great! Formatting we can always deal with.

@ianmacl ianmacl referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ianmacl ianmacl referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
8 libraries/joomla/document/html/html.php
@@ -188,9 +188,9 @@ public function mergeHeadData($data)
*/
public function addHeadLink($href, $relation, $relType = 'rel', $attribs = array())
{
- $attribs = JArrayHelper::toString($attribs);
- $generatedTag = '<link href="'.$href.'" '.$relType.'="'.$relation.'" '.$attribs;
- $this->_links[] = $generatedTag;
+ $this->_links[$href]['relation'] = $relation;
+ $this->_links[$href]['relType'] = $relType;
+ $this->_links[$href]['attribs'] = $attribs;
}
/**
@@ -207,7 +207,7 @@ public function addHeadLink($href, $relation, $relType = 'rel', $attribs = array
public function addFavicon($href, $type = 'image/vnd.microsoft.icon', $relation = 'shortcut icon')
{
$href = str_replace('\\', '/', $href);
- $this->_links[] = '<link href="'.$href.'" rel="'.$relation.'" type="'.$type.'"';
+ $this->addHeadLink($href, $relation, 'rel', array('type' => $type));
}
/**
View
9 libraries/joomla/document/html/renderer/head.php
@@ -82,8 +82,13 @@ public function fetchHead(&$document)
$buffer .= $tab.'<title>'.htmlspecialchars($document->getTitle(), ENT_COMPAT, 'UTF-8').'</title>'.$lnEnd;
// Generate link declarations
- foreach ($document->_links as $link) {
- $buffer .= $tab.$link.$tagEnd.$lnEnd;
+ foreach ($document->_links as $link => $linkAtrr)
+ {
+ $buffer .= $tab.'<link href="'.$link.'" '.$linkAtrr['relType'].'="'.$linkAtrr['relation'].'"';
+ if ($temp = JArrayHelper::toString($linkAtrr['attribs'])) {
+ $buffer .= ' '.$temp;
+ }
+ $buffer .= ' />'.$lnEnd;
}
// Generate stylesheet links
Something went wrong with that request. Please try again.