• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Widget Sytem Improvements

Kirby

Well-known member
#1
The widget system is great, but I still think there a few (simple) things that could make it even more awesome:

Allow users to override the template
Doing this would allow to use the same widget definition in various places possible having completely different looks

Caching
Some widgets might benefit from caching, so if the base class would already offer caching functionality this would be a plus

Permissions/Usergroup Selection
Sometimes it is desirable to show certain widgets to certain users/uergroups only.
For example their could be a "Unread Posts in Staff Forum" widget,.
As it is right now the widget would (uselessly) query the data for every visitor and end up with "You have no unread posts." for everyone (except staff).
 

RobParker

Well-known member
#2
Can't the permission stuff be done with template conditionals?

Yeah it's not as nice but it's possible.

Very strongly agree about caching, that could make a massive difference if implemented.
 

Mike

XenForo developer
Staff member
#5
Just in regards to caching: we discussed this beforehand, but we didn't believe there was anything that should really be implemented at a general level. The only thing that is really cacheable there is HTML output, which is not really appropriate as a generic cache element (this would vary per user and per style). Beyond that, anything cacheable is widget specific. We wouldn't recommend caching entity data (and we have blocked direct caching of entities by blocking serialization of them), so at that point, you should really just be caching IDs, but then you need to potentially take into account varying user permissions, so you should be overfetching and filtering down when you get the data...

So yeah, if caching is desired, it'd best be done within the entity, likely using the standard caching framework.