Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
2acc93b9
Commit
2acc93b9
authored
Oct 24, 2014
by
catch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2357937
by Wim Leers: Remove {{ feed_icons }} from page template (page.html.twig).
parent
3e53bf23
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
27 additions
and
96 deletions
+27
-96
core/includes/common.inc
core/includes/common.inc
+7
-34
core/includes/theme.inc
core/includes/theme.inc
+0
-15
core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php
core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php
+0
-9
core/modules/system/src/Tests/Common/AddFeedTest.php
core/modules/system/src/Tests/Common/AddFeedTest.php
+3
-2
core/modules/system/templates/page.html.twig
core/modules/system/templates/page.html.twig
+0
-3
core/modules/views/src/Plugin/views/style/Rss.php
core/modules/views/src/Plugin/views/style/Rss.php
+15
-24
core/modules/views/src/Tests/Wizard/BasicTest.php
core/modules/views/src/Tests/Wizard/BasicTest.php
+2
-1
core/themes/bartik/templates/page.html.twig
core/themes/bartik/templates/page.html.twig
+0
-2
core/themes/seven/templates/page.html.twig
core/themes/seven/templates/page.html.twig
+0
-6
No files found.
core/includes/common.inc
View file @
2acc93b9
...
...
@@ -233,39 +233,6 @@ function drupal_get_html_head($render = TRUE) {
}
}
/**
* Adds a feed URL for the current page.
*
* This function can be called as long the HTML header hasn't been sent.
*
* @param $url
* An internal system path or a fully qualified external URL of the feed.
* @param $title
* The title of the feed.
*
* @deprecated in Drupal 8.0.x, will be removed before Drupal 8.0.0
* Use #attached on render arrays.
*/
function
_drupal_add_feed
(
$url
=
NULL
,
$title
=
''
)
{
$stored_feed_links
=
&
drupal_static
(
__FUNCTION__
,
array
());
if
(
isset
(
$url
))
{
$stored_feed_links
[
$url
]
=
array
(
'url'
=>
$url
,
'title'
=>
$title
);
}
return
$stored_feed_links
;
}
/**
* Gets the feed URLs for the current page.
*
* @deprecated in Drupal 8.0.x, will be removed before Drupal 8.0.0
* Use #attached on render arrays.
*/
function
drupal_get_feeds
()
{
$feeds
=
_drupal_add_feed
();
return
$feeds
;
}
/**
* Prepares a 'destination' URL query parameter for use with url().
*
...
...
@@ -1870,7 +1837,13 @@ function drupal_process_attached($elements, $dependency_check = FALSE) {
call_user_func_array
(
'_drupal_add_html_head'
,
$args
);
break
;
case
'feed'
:
call_user_func_array
(
'_drupal_add_feed'
,
$args
);
$args
=
[[
'href'
=>
$args
[
0
],
'rel'
=>
'alternate'
,
'title'
=>
$args
[
1
],
'type'
=>
'application/rss+xml'
,
]];
call_user_func_array
(
'_drupal_add_html_head_link'
,
$args
);
break
;
case
'html_head_link'
:
call_user_func_array
(
'_drupal_add_html_head_link'
,
$args
);
...
...
core/includes/theme.inc
View file @
2acc93b9
...
...
@@ -17,7 +17,6 @@
use
Drupal\Core\Config\StorageException
;
use
Drupal\Core\Extension\Extension
;
use
Drupal\Core\Extension\ExtensionNameLengthException
;
use
Drupal\Core\Page\FeedLinkElement
;
use
Drupal\Core\Page\LinkElement
;
use
Drupal\Core\Page\MetaElement
;
use
Drupal\Core\Template\Attribute
;
...
...
@@ -1776,24 +1775,10 @@ function template_preprocess_page(&$variables) {
if
(
!
defined
(
'MAINTENANCE_MODE'
))
{
$variables
[
'action_links'
]
=
menu_get_local_actions
();
$variables
[
'tabs'
]
=
menu_local_tabs
();
// Convert drupal_get_feeds to feed links on the page object.
/** @var \Drupal\Core\Page\HtmlPage $page */
$page
=
$variables
[
'page'
][
'#page'
];
// Render the feed icons.
$variables
[
'feed_icons'
]
=
array
();
foreach
(
$page
->
getFeedLinkElements
()
as
$link
)
{
$variables
[
'feed_icons'
][]
=
array
(
'#theme'
=>
'feed_icon'
,
'#url'
=>
$link
->
getAttributes
()[
'href'
],
'#title'
=>
$link
->
getAttributes
()[
'title'
],
);
}
}
else
{
$variables
[
'action_links'
]
=
array
();
$variables
[
'tabs'
]
=
array
();
$variables
[
'feed_icons'
]
=
''
;
}
if
(
$node
=
\
Drupal
::
routeMatch
()
->
getParameter
(
'node'
))
{
...
...
core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php
View file @
2acc93b9
...
...
@@ -109,15 +109,6 @@ public function preparePage(HtmlPage $page, &$page_array) {
$this
->
setDefaultMetaTags
(
$page
);
// @todo: collect feed links from #attached rather than a static once
// http://drupal.org/node/2256365 is completed.
foreach
(
drupal_get_feeds
()
as
$feed
)
{
// Force the URL to be absolute, for consistency with other <link> tags
// output by Drupal.
$link
=
new
FeedLinkElement
(
$feed
[
'title'
],
_url
(
$feed
[
'url'
],
array
(
'absolute'
=>
TRUE
)));
$page
->
addLinkElement
(
$link
);
}
// Add libraries and CSS used by this theme.
$active_theme
=
\
Drupal
::
theme
()
->
getActiveTheme
();
foreach
(
$active_theme
->
getLibraries
()
as
$library
)
{
...
...
core/modules/system/src/Tests/Common/AddFeedTest.php
View file @
2acc93b9
...
...
@@ -12,13 +12,14 @@
use
Drupal\simpletest\WebTestBase
;
/**
* Make sure that
_drupal_add_
feed
()
works correctly with various constructs.
* Make sure that
attaching
feed
s
works correctly with various constructs.
*
* @group Common
*/
class
AddFeedTest
extends
WebTestBase
{
/**
* Tests
_drupal_add_
feed
()
with paths, URLs, and titles.
* Tests
attaching
feed
s
with paths, URLs, and titles.
*/
function
testBasicFeedAddNoTitle
()
{
$path
=
$this
->
randomMachineName
(
12
);
...
...
core/modules/system/templates/page.html.twig
View file @
2acc93b9
...
...
@@ -39,7 +39,6 @@
* view and edit tabs when displaying a node).
* - action_links: Actions local to the page, such as "Add menu" on the menu
* administration interface.
* - feed_icons: All feed icons for the current page.
* - node: Fully loaded node, if there is an automatically-loaded node
* associated with the page and the node ID is the second argument in the
* page's path (e.g. node/12345 and node/12345/revisions, but not
...
...
@@ -122,8 +121,6 @@
{%
endif
%}
{{
page.content
}}
{{
feed_icons
}}
</div>
{# /.layout-content #}
{%
if
page.sidebar_first
%}
...
...
core/modules/views/src/Plugin/views/style/Rss.php
View file @
2acc93b9
...
...
@@ -33,7 +33,6 @@ class Rss extends StylePluginBase {
protected
$usesRowPlugin
=
TRUE
;
public
function
attachTo
(
array
&
$build
,
$display_id
,
$path
,
$title
)
{
$display
=
$this
->
view
->
displayHandlers
->
get
(
$display_id
);
$url_options
=
array
();
$input
=
$this
->
view
->
getExposedInput
();
if
(
$input
)
{
...
...
@@ -42,29 +41,21 @@ public function attachTo(array &$build, $display_id, $path, $title) {
$url_options
[
'absolute'
]
=
TRUE
;
$url
=
_url
(
$this
->
view
->
getUrl
(
NULL
,
$path
),
$url_options
);
if
(
$display
->
hasPath
())
{
if
(
empty
(
$this
->
preview
))
{
// Add a call for _drupal_add_feed to the view attached data.
$build
[
'#attached'
][
'feed'
][]
=
array
(
$url
,
$title
);
}
}
else
{
// Add the RSS icon to the view.
$feed_icon
=
array
(
'#theme'
=>
'feed_icon'
,
'#url'
=>
$url
,
'#title'
=>
$title
,
);
$this
->
view
->
feed_icon
=
$feed_icon
;
// Attach a link to the RSS feed, which is an alternate representation.
$build
[
'#attached'
][
'html_head_link'
][][]
=
array
(
'rel'
=>
'alternate'
,
'type'
=>
'application/rss+xml'
,
'title'
=>
$title
,
'href'
=>
$url
,
);
}
// Add the RSS icon to the view.
$this
->
view
->
feed_icon
=
[
'#theme'
=>
'feed_icon'
,
'#url'
=>
$url
,
'#title'
=>
$title
,
];
// Attach a link to the RSS feed, which is an alternate representation.
$build
[
'#attached'
][
'html_head_link'
][][]
=
array
(
'rel'
=>
'alternate'
,
'type'
=>
'application/rss+xml'
,
'title'
=>
$title
,
'href'
=>
$url
,
);
}
protected
function
defineOptions
()
{
...
...
core/modules/views/src/Tests/Wizard/BasicTest.php
View file @
2acc93b9
...
...
@@ -74,7 +74,8 @@ function testViewsWizardAndListing() {
$this
->
assertText
(
$node2
->
label
());
// Check if we have the feed.
$this
->
assertLinkByHref
(
_url
(
$view2
[
'page[feed_properties][path]'
]));
$elements
=
$this
->
cssSelect
(
'link[href="'
.
_url
(
$view2
[
'page[feed_properties][path]'
],
[
'absolute'
=>
TRUE
])
.
'"]'
);
$this
->
assertEqual
(
count
(
$elements
),
1
,
'Feed found.'
);
$this
->
drupalGet
(
$view2
[
'page[feed_properties][path]'
]);
$this
->
assertRaw
(
'<rss version="2.0"'
);
// The feed should have the same title and nodes as the page.
...
...
core/themes/bartik/templates/page.html.twig
View file @
2acc93b9
...
...
@@ -46,7 +46,6 @@
* view and edit tabs when displaying a node).
* - action_links: Actions local to the page, such as "Add menu" on the menu
* administration interface.
* - feed_icons: All feed icons for the current page.
* - node: Fully loaded node, if there is an automatically-loaded node
* associated with the page and the node ID is the second argument in the
* page's path (e.g. node/12345 and node/12345/revisions, but not
...
...
@@ -155,7 +154,6 @@
</ul>
{%
endif
%}
{{
page.content
}}
{{
feed_icons
}}
</section></main>
<!-- /.section, /#content -->
{%
if
page.sidebar_first
%}
...
...
core/themes/seven/templates/page.html.twig
View file @
2acc93b9
...
...
@@ -40,7 +40,6 @@
* view and edit tabs when displaying a node).
* - action_links: Actions local to the page, such as "Add menu" on the menu
* administration interface.
* - feed_icons: All feed icons for the current page.
* - node: Fully loaded node, if there is an automatically-loaded node
* associated with the page and the node ID is the second argument in the
* page's path (e.g. node/12345 and node/12345/revisions, but not
...
...
@@ -95,10 +94,5 @@
{%
endif
%}
{{
page.content
}}
</main>
{%
if
feed_icons
%}
<footer
role=
"contentinfo"
class=
"footer layout-column"
>
{{
feed_icons
}}
</footer>
{%
endif
%}
</div>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment