Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3338541
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3338541
Commits
eb70a1c1
Commit
eb70a1c1
authored
9 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2509600
by andypost: AggregatorFeedBlock should return render array
parent
31da5142
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
+20
-25
20 additions, 25 deletions
...dules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
with
20 additions
and
25 deletions
core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
+
20
−
25
View file @
eb70a1c1
...
...
@@ -154,32 +154,27 @@ public function build() {
->
sort
(
'iid'
,
'DESC'
)
->
execute
();
$items
=
$this
->
itemStorage
->
loadMultiple
(
$result
);
$more_link
=
array
(
'#type'
=>
'more_link'
,
'#url'
=>
$feed
->
urlInfo
(),
'#attributes'
=>
array
(
'title'
=>
$this
->
t
(
"View this feed's recent news."
)),
);
$read_more
=
drupal_render
(
$more_link
);
$rendered_items
=
array
();
foreach
(
$items
as
$item
)
{
$aggregator_block_item
=
array
(
'#type'
=>
'link'
,
'#url'
=>
$item
->
urlInfo
(),
'#title'
=>
$item
->
label
(),
);
$rendered_items
[]
=
drupal_render
(
$aggregator_block_item
);
}
// Only display the block if there are items to show.
if
(
count
(
$rendered_items
)
>
0
)
{
$item_list
=
array
(
if
(
$result
)
{
// Only display the block if there are items to show.
$items
=
$this
->
itemStorage
->
loadMultiple
(
$result
);
$build
[
'list'
]
=
[
'#theme'
=>
'item_list'
,
'#items'
=>
$rendered_items
,
);
return
array
(
'#children'
=>
drupal_render
(
$item_list
)
.
$read_more
,
);
'#items'
=>
[],
];
foreach
(
$items
as
$item
)
{
$build
[
'list'
][
'#items'
][
$item
->
id
()]
=
[
'#type'
=>
'link'
,
'#url'
=>
$item
->
urlInfo
(),
'#title'
=>
$item
->
label
(),
];
}
$build
[
'more_link'
]
=
[
'#type'
=>
'more_link'
,
'#url'
=>
$feed
->
urlInfo
(),
'#attributes'
=>
[
'title'
=>
$this
->
t
(
"View this feed's recent news."
)],
];
return
$build
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment