Ticket #1571 (closed New feature: wontfix)
Allow plugins to create new View types for reports in widgets
| Reported by: | greg | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | Feature requests |
| Component: | Core | Keywords: | interesting |
| Cc: | Sensitive: | no |
Description
In fact most of the Piwik widgets already have multiple "pages". The first one is the data table, the second is the extended data table and then followed by several charts (bar, pie) and the tag cloud. I think this is a very good way of providing multiple presentations to the same data and it would be take this feature a little further.
problem definition
By now the multi-page widget is implemented inside one view (ViewDataTable). As a plugin developer it is very hard to understand this implementation (at least it is hard for me) and it seems impossible to add new "pages" to existing widgets without hacking the Piwik core. Why not moving the multi-page widget implementation into the widget architecture?
proposal
Each widget is able to define one or many pages. If there is only one page, the output is simply printed into the widget container. But if a widget defines multiple pages, the widget autmatically displays ui elements to let the user change the page (currently the icon bar footer).
To define a mulitple-page widget, the developer has to provide the following information for each widget page:
- id (unique inside the widget)
- icon filename (displayed in the icon bar)
- translated title (displayed in the icons tooltip)
- controller function that renders the widget page
benefits
- It would simplify the process of writing new multi-page widgets for plugin developers a lot. Plugin developers wouldn't have to care about restoring the last opened page on new requests, etc.
- It would ensure that all multi-page widgets share consistent UI elements, which makes theming or future UI changes much easier.
- It could allow plugin developers to add new pages to existing widgets or to replace existing pages. It would simplify the process of integrating new representations like #1514, #1558 or #1560 into existing dashboard widgets.
