bookmark-pages/Classes/Widgets/TopBookmarksWidget.php

66 lines
1.7 KiB
PHP
Raw Normal View History

2021-08-20 16:25:22 +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\TopBookmarksDataProvider;
class TopBookmarksWidget implements WidgetInterface
{
/**
* @var WidgetConfigurationInterface
*/
private $configuration;
/**
* @var StandaloneView
*/
private $view;
/**
* @var array
*/
private $options;
/**
* @var ButtonProviderInterface|null
*/
private $buttonProvider;
/**
* @var TopBookmarksDataProvider
*/
private $dataProvider;
public function __construct(
WidgetConfigurationInterface $configuration,
TopBookmarksDataProvider $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
{
$this->view->setTemplate('TopBookmarksWidget');
$this->view->assignMultiple([
'items' => $this->dataProvider->getItems(),
'options' => $this->options,
'button' => $this->buttonProvider,
'configuration' => $this->configuration,
]);
return $this->view->render();
}
}