bookmark-pages/Classes/Widgets/TopLikesWidget.php

66 lines
1.7 KiB
PHP
Raw Permalink Normal View History

2021-08-17 19:45:38 +02:00
<?php
namespace WapplerSystems\BookmarksLikesRatings\Widgets;
use TYPO3\CMS\Dashboard\Widgets\ButtonProviderInterface;
use TYPO3\CMS\Dashboard\Widgets\WidgetConfigurationInterface;
use TYPO3\CMS\Dashboard\Widgets\WidgetInterface;
use TYPO3\CMS\Fluid\View\StandaloneView;
use WapplerSystems\BookmarksLikesRatings\Widgets\Provider\TopLikesDataProvider;
class TopLikesWidget implements WidgetInterface
{
/**
* @var WidgetConfigurationInterface
*/
private $configuration;
/**
* @var StandaloneView
*/
private $view;
/**
* @var array
*/
private $options;
/**
* @var ButtonProviderInterface|null
*/
private $buttonProvider;
/**
* @var TopLikesDataProvider
*/
private $dataProvider;
public function __construct(
WidgetConfigurationInterface $configuration,
TopLikesDataProvider $dataProvider,
StandaloneView $view,
$buttonProvider = null,
array $options = []
)
{
$this->configuration = $configuration;
$this->view = $view;
$this->options = $options;
$this->buttonProvider = $buttonProvider;
$this->dataProvider = $dataProvider;
}
public function renderWidgetContent(): string
{
2021-08-20 13:33:13 +02:00
$this->view->setTemplate('TopLikesWidget');
2021-08-17 19:45:38 +02:00
$this->view->assignMultiple([
2021-08-20 13:33:13 +02:00
'items' => $this->dataProvider->getItems(),
2021-08-17 19:45:38 +02:00
'options' => $this->options,
'button' => $this->buttonProvider,
'configuration' => $this->configuration,
]);
return $this->view->render();
}
}