public function RecentCalendarPublicationsBlock::build in Content Planner 8
Build the block and return a renderable array.
Return value
array The render array for the block.
Overrides DashboardBlockBase::build
File
- modules/
content_calendar/ src/ Plugin/ DashboardBlock/ RecentCalendarPublicationsBlock.php, line 23
Class
- RecentCalendarPublicationsBlock
- Provides a block with recent calendar publications for Content Planner Dashboard.
Namespace
Drupal\content_calendar\Plugin\DashboardBlockCode
public function build() {
$config = $this
->getConfiguration();
$contentService = new ContentService();
// Last publications.
$last_publications_limit_config = $this
->getCustomConfigByKey($config, 'last_publications_limit', 3);
$last_nodes = $contentService
->getRecentContent($last_publications_limit_config);
// Next publications.
$next_publications_limit_config = $this
->getCustomConfigByKey($config, 'next_publications_limit', 3);
$next_nodes = $contentService
->getFollowingContent($next_publications_limit_config);
return [
'#theme' => 'recent_calendar_content',
'#last_nodes' => $last_nodes,
'#next_nodes' => $next_nodes,
];
}