summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2013-11-21 10:05:28 (GMT)
committerNathaniel Catchpole2013-11-21 10:05:28 (GMT)
commit390d04eef792f7f0ac6c3a03986b8eacf9c07d32 (patch)
tree6cd4ba3fc3d46907fd410d38624c878563dc2416
parent4ae91a1d344167eaabb4fa1961b9212a8353f73c (diff)
Issue #2115061 by JeroenT, tim.plunkett: Remove direct calls to drupal_add_html_head_link().
-rw-r--r--core/includes/common.inc5
-rw-r--r--core/includes/theme.inc14
-rw-r--r--core/modules/book/book.module21
-rw-r--r--core/modules/taxonomy/taxonomy.pages.inc16
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php8
5 files changed, 51 insertions, 13 deletions
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 138c11a..fc46b9b 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -399,14 +399,15 @@ function drupal_add_feed($url = NULL, $title = '') {
if (isset($url)) {
$stored_feed_links[$url] = theme('feed_icon', array('url' => $url, 'title' => $title));
- drupal_add_html_head_link(array(
+ $build['#attached']['drupal_add_html_head_link'][][] = array(
'rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => $title,
// Force the URL to be absolute, for consistency with other <link> tags
// output by Drupal.
'href' => url($url, array('absolute' => TRUE)),
- ));
+ );
+ drupal_render($build);
}
return $stored_feed_links;
}
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index c4047b4..98be6de 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2221,7 +2221,12 @@ function template_preprocess_html(&$variables) {
if (theme_get_setting('features.favicon')) {
$favicon = theme_get_setting('favicon.url');
$type = theme_get_setting('favicon.mimetype');
- drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => Url::stripDangerousProtocols($favicon), 'type' => $type));
+ $build['#attached']['drupal_add_html_head_link'][][] = array(
+ 'rel' => 'shortcut icon',
+ 'href' => Url::stripDangerousProtocols($favicon),
+ 'type' => $type,
+ );
+ drupal_render($build);
}
$site_config = \Drupal::config('system.site');
@@ -2504,7 +2509,12 @@ function template_preprocess_maintenance_page(&$variables) {
if (theme_get_setting('features.favicon')) {
$favicon = theme_get_setting('favicon.url');
$type = theme_get_setting('favicon.mimetype');
- drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => Url::stripDangerousProtocols($favicon), 'type' => $type));
+ $build['#attached']['drupal_add_html_head_link'][][] = array(
+ 'rel' => 'shortcut icon',
+ 'href' => Url::stripDangerousProtocols($favicon),
+ 'type' => $type,
+ );
+ drupal_render($build);
}
// Get all region content set with drupal_add_region_content().
diff --git a/core/modules/book/book.module b/core/modules/book/book.module
index cd7d714..c9fccf5 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -696,28 +696,43 @@ function template_preprocess_book_navigation(&$variables) {
if ($book_link['mlid']) {
$variables['tree'] = book_children($book_link);
+ $build = array();
+
if ($prev = book_prev($book_link)) {
$prev_href = url($prev['href']);
- drupal_add_html_head_link(array('rel' => 'prev', 'href' => $prev_href));
+ $build['#attached']['drupal_add_html_head_link'][][] = array(
+ 'rel' => 'prev',
+ 'href' => $prev_href,
+ );
$variables['prev_url'] = $prev_href;
$variables['prev_title'] = check_plain($prev['title']);
}
if ($book_link['plid'] && $parent = book_link_load($book_link['plid'])) {
$parent_href = url($parent['link_path']);
- drupal_add_html_head_link(array('rel' => 'up', 'href' => $parent_href));
+ $build['#attached']['drupal_add_html_head_link'][][] = array(
+ 'rel' => 'up',
+ 'href' => $parent_href,
+ );
$variables['parent_url'] = $parent_href;
$variables['parent_title'] = check_plain($parent['title']);
}
if ($next = book_next($book_link)) {
$next_href = url($next['href']);
- drupal_add_html_head_link(array('rel' => 'next', 'href' => $next_href));
+ $build['#attached']['drupal_add_html_head_link'][][] = array(
+ 'rel' => 'next',
+ 'href' => $next_href,
+ );
$variables['next_url'] = $next_href;
$variables['next_title'] = check_plain($next['title']);
}
}
+ if (!empty($build)) {
+ drupal_render($build);
+ }
+
$variables['has_links'] = FALSE;
// Link variables to filter for values and set state of the flag variable.
$links = array('prev_url', 'prev_title', 'parent_url', 'parent_title', 'next_url', 'next_title');
diff --git a/core/modules/taxonomy/taxonomy.pages.inc b/core/modules/taxonomy/taxonomy.pages.inc
index fb88184..96f84aa 100644
--- a/core/modules/taxonomy/taxonomy.pages.inc
+++ b/core/modules/taxonomy/taxonomy.pages.inc
@@ -24,11 +24,23 @@ function taxonomy_term_page(Term $term) {
foreach ($term->uriRelationships() as $rel) {
$uri = $term->uri($rel);
// Set the term path as the canonical URL to prevent duplicate content.
- drupal_add_html_head_link(array('rel' => $rel, 'href' => url($uri['path'], $uri['options'])), TRUE);
+ $build['#attached']['drupal_add_html_head_link'][] = array(
+ array(
+ 'rel' => $rel,
+ 'href' => url($uri['path'], $uri['options']),
+ ),
+ TRUE,
+ );
if ($rel == 'canonical') {
// Set the non-aliased canonical path as a default shortlink.
- drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE);
+ $build['#attached']['drupal_add_html_head_link'][] = array(
+ array(
+ 'rel' => 'shortlink',
+ 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE))),
+ ),
+ TRUE,
+ );
}
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php b/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php
index 7b1e0b1..136e5bb 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php
@@ -57,13 +57,13 @@ class Rss extends StylePluginBase {
'#url' => $url,
'#title' => $title,
);
- $this->view->feed_icon .= drupal_render($feed_icon);
- drupal_add_html_head_link(array(
+ $feed_icon['#attached']['drupal_add_html_head_link'][][] = array(
'rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => $title,
- 'href' => $url
- ));
+ 'href' => $url,
+ );
+ $this->view->feed_icon .= drupal_render($feed_icon);
}
}