Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
15ddad3b
Commit
15ddad3b
authored
Nov 11, 2014
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2359161
by olli, damiankloip: Fixed Feed icons missing in views blocks and pages.
parent
29817e45
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
36 additions
and
14 deletions
+36
-14
core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
...ules/views/src/Plugin/views/display/DisplayPluginBase.php
+2
-2
core/modules/views/src/Plugin/views/display/Feed.php
core/modules/views/src/Plugin/views/display/Feed.php
+3
-0
core/modules/views/src/Plugin/views/style/Opml.php
core/modules/views/src/Plugin/views/style/Opml.php
+1
-2
core/modules/views/src/Plugin/views/style/Rss.php
core/modules/views/src/Plugin/views/style/Rss.php
+1
-1
core/modules/views/src/Tests/Plugin/DisplayFeedTest.php
core/modules/views/src/Tests/Plugin/DisplayFeedTest.php
+12
-0
core/modules/views/src/Tests/Wizard/BasicTest.php
core/modules/views/src/Tests/Wizard/BasicTest.php
+1
-0
core/modules/views/src/ViewExecutable.php
core/modules/views/src/ViewExecutable.php
+7
-0
core/modules/views/templates/views-view.html.twig
core/modules/views/templates/views-view.html.twig
+4
-4
core/modules/views/tests/modules/views_test_data/templates/views-view--frontpage.html.twig
...views_test_data/templates/views-view--frontpage.html.twig
+4
-4
core/modules/views/views.module
core/modules/views/views.module
+1
-1
No files found.
core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
View file @
15ddad3b
...
...
@@ -2178,7 +2178,7 @@ public function elementPreRender(array $element) {
$element
[
'#empty'
]
=
$empty
?
$view
->
display_handler
->
renderArea
(
'empty'
,
$empty
)
:
array
();
$element
[
'#exposed'
]
=
!
empty
(
$view
->
exposed_widgets
)
?
$view
->
exposed_widgets
:
array
();
$element
[
'#more'
]
=
$view
->
display_handler
->
renderMoreLink
();
$element
[
'#feed_icon'
]
=
!
empty
(
$view
->
feed
_i
con
)
?
$view
->
feed
_i
con
:
array
();
$element
[
'#feed_icon
s
'
]
=
!
empty
(
$view
->
feed
I
con
s
)
?
$view
->
feed
I
con
s
:
array
();
if
(
$view
->
display_handler
->
renderPager
())
{
$exposed_input
=
isset
(
$view
->
exposed_raw_input
)
?
$view
->
exposed_raw_input
:
NULL
;
...
...
@@ -2213,7 +2213,7 @@ public function elementPreRender(array $element) {
$element
[
'#pager'
]
=
array
();
$element
[
'#footer'
]
=
array
();
$element
[
'#more'
]
=
array
();
$element
[
'#feed_icon'
]
=
array
();
$element
[
'#feed_icon
s
'
]
=
array
();
}
$element
[
'#rows'
]
=
$form
;
...
...
core/modules/views/src/Plugin/views/display/Feed.php
View file @
15ddad3b
...
...
@@ -269,6 +269,9 @@ public function attachTo(ViewExecutable $clone, $display_id, array &$build) {
$clone
->
buildTitle
();
if
(
$plugin
=
$clone
->
display_handler
->
getPlugin
(
'style'
))
{
$plugin
->
attachTo
(
$build
,
$display_id
,
$this
->
getPath
(),
$clone
->
getTitle
());
foreach
(
$clone
->
feedIcons
as
$feed_icon
)
{
$this
->
view
->
feedIcons
[]
=
$feed_icon
;
}
}
// Clean up.
...
...
core/modules/views/src/Plugin/views/style/Opml.php
View file @
15ddad3b
...
...
@@ -48,12 +48,11 @@ public function attachTo(array &$build, $display_id, $path, $title) {
}
}
else
{
$feed
_i
con
=
array
(
$
this
->
view
->
feed
I
con
s
[]
=
array
(
'#theme'
=>
'feed_icon'
,
'#url'
=>
$url
,
'#title'
=>
$title
,
);
$this
->
view
->
feed_icon
=
$feed_icon
;
}
}
...
...
core/modules/views/src/Plugin/views/style/Rss.php
View file @
15ddad3b
...
...
@@ -43,7 +43,7 @@ public function attachTo(array &$build, $display_id, $path, $title) {
$url
=
_url
(
$this
->
view
->
getUrl
(
NULL
,
$path
),
$url_options
);
// Add the RSS icon to the view.
$this
->
view
->
feed
_i
con
=
[
$this
->
view
->
feed
I
con
s
[]
=
[
'#theme'
=>
'feed_icon'
,
'#url'
=>
$url
,
'#title'
=>
$title
,
...
...
core/modules/views/src/Tests/Plugin/DisplayFeedTest.php
View file @
15ddad3b
...
...
@@ -42,6 +42,7 @@ protected function setUp() {
* Tests the rendered output.
*/
public
function
testFeedOutput
()
{
$this
->
drupalCreateContentType
([
'type'
=>
'page'
]);
$this
->
drupalCreateNode
();
// Test the site name setting.
...
...
@@ -60,6 +61,17 @@ public function testFeedOutput() {
$this
->
drupalGet
(
'test-feed-display.xml'
);
$result
=
$this
->
xpath
(
'//title'
);
$this
->
assertEqual
(
$result
[
0
],
'test_display_feed'
,
'The display title is used for the feed title.'
);
// Add a block display and attach the feed.
$view
->
getExecutable
()
->
newDisplay
(
'block'
,
NULL
,
'test'
);
$display
=
&
$view
->
getDisplay
(
'feed_1'
);
$display
[
'display_options'
][
'displays'
][
'test'
]
=
'test'
;
$view
->
save
();
// Test the feed display adds a feed icon to the block display.
$this
->
drupalPlaceBlock
(
'views_block:test_display_feed-test'
);
$this
->
drupalGet
(
'<front>'
);
$feed_icon
=
$this
->
cssSelect
(
'div.view-id-test_display_feed a.feed-icon'
);
$this
->
assertTrue
(
strpos
(
$feed_icon
[
0
][
'href'
],
'test-feed-display.xml'
),
'The feed icon was found.'
);
}
}
core/modules/views/src/Tests/Wizard/BasicTest.php
View file @
15ddad3b
...
...
@@ -74,6 +74,7 @@ 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]'
]);
...
...
core/modules/views/src/ViewExecutable.php
View file @
15ddad3b
...
...
@@ -125,6 +125,13 @@ class ViewExecutable {
*/
public
$attachment_after
=
array
();
/**
* Feed icons attached to the view.
*
* @var array
*/
public
$feedIcons
=
array
();
// Exposed widget input
/**
...
...
core/modules/views/templates/views-view.html.twig
View file @
15ddad3b
...
...
@@ -20,7 +20,7 @@
* - empty: The content to display if there are no rows.
* - pager: The optional pager next/prev links to display.
* - exposed: Exposed widget form/info to display.
* - feed_icon:
An o
ptional feed icon to display.
* - feed_icon
s
:
O
ptional feed icon
s
to display.
* - more: An optional link to the next page of results.
* - title: Title of the view, only used when displaying in the admin preview.
* - title_prefix: Additional output populated by modules, intended to be
...
...
@@ -85,9 +85,9 @@
{{
footer
}}
</div>
{%
endif
%}
{%
if
feed_icon
%}
<div
class=
"feed-icon"
>
{{
feed_icon
}}
{%
if
feed_icon
s
%}
<div
class=
"feed-icon
s
"
>
{{
feed_icon
s
}}
</div>
{%
endif
%}
</div>
core/modules/views/tests/modules/views_test_data/templates/views-view--frontpage.html.twig
View file @
15ddad3b
...
...
@@ -20,7 +20,7 @@
* - empty: The content to display if there are no rows.
* - pager: The optional pager next/prev links to display.
* - exposed: Exposed widget form/info to display.
* - feed_icon:
An o
ptional feed icon to display.
* - feed_icon
s
:
O
ptional feed icon
s
to display.
* - more: An optional link to the next page of results.
* - title: Title of the view, only used when displaying in the admin preview.
* - title_prefix: Additional output populated by modules, intended to be
...
...
@@ -80,9 +80,9 @@
{{
footer
}}
</div>
{%
endif
%}
{%
if
feed_icon
%}
<div
class=
"feed-icon"
>
{{
feed_icon
}}
{%
if
feed_icon
s
%}
<div
class=
"feed-icon
s
"
>
{{
feed_icon
s
}}
</div>
{%
endif
%}
</div>
core/modules/views/views.module
View file @
15ddad3b
...
...
@@ -110,7 +110,7 @@ function views_theme($existing, $type, $theme, $path) {
'empty'
=>
array
(),
'exposed'
=>
array
(),
'more'
=>
array
(),
'feed_icon'
=>
array
(),
'feed_icon
s
'
=>
array
(),
'pager'
=>
array
(),
'title'
=>
''
,
'attachment_before'
=>
array
(),
...
...
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