ListWidget
class \
- Implements
- WidgetRendererInterface
Concrete List Widget implementation
The widget will show a simple list with items provided by a data provider. You can add a button to the widget by defining a button provider.
A data provider implementing PaginatedListDataProviderInterface makes the widget render a paginator in its footer. Editors can then configure the number of items per page in the widget settings.
The following options are available during registration:
- itemsPerPage int default: 10 Number of items per page. Only used for paginated data providers. If set, editors cannot change the value.
Tags
Table of Contents
Interfaces
- WidgetRendererInterface
- The WidgetRendererInterface is the (new) base interface for all kind of widgets.
Methods
- __construct() : mixed
- getSettingsDefinitions() : SettingDefinition[]
- renderWidget() : WidgetResult
- This method returns the content of a widget. The returned markup will be delivered by an AJAX call and will not be escaped.
- getItems() : array
- getPaginator() : PaginatorInterface|null
Methods
__construct()
public
__construct(WidgetConfigurationInterface $configuration, ListDataProviderInterface|PaginatedListDataProviderInterface $dataProvider, BackendViewFactory $backendViewFactory[, ButtonProviderInterface|null $buttonProvider = null ][, array $options = [] ]) : mixed
Parameters
- $configuration : WidgetConfigurationInterface
- $dataProvider : ListDataProviderInterface|PaginatedListDataProviderInterface
- $backendViewFactory : BackendViewFactory
- $buttonProvider : ButtonProviderInterface|null = null
- $options : array = []
getSettingsDefinitions()
public
getSettingsDefinitions() : SettingDefinition[]
Return values
SettingDefinition[]renderWidget()
This method returns the content of a widget. The returned markup will be delivered by an AJAX call and will not be escaped.
public
renderWidget(WidgetContext $context) : WidgetResult
Be aware of XSS and ensure that the content is well encoded.
Parameters
- $context : WidgetContext
Return values
WidgetResultgetItems()
protected
getItems() : array
Return values
arraygetPaginator()
protected
getPaginator(WidgetContext $context) : PaginatorInterface|null
Parameters
- $context : WidgetContext