Widget attribute clarifications

There is no standard set of attributes because each widget is different. You’re most likely looking at the topic rendering, where each post receives a series of attributes. The basic post attributes are created here.

In some sub-widgets, you’ll find fewer or different attributes are passed in. You have to review the widget code to see what attributes are passed.

Your plugin would have to add that attribute to one of the serializers used to generate attributes. It’s probably going to go into the post serializer. You should have access to it via attrs.post.get('trust_level') at that point.

You need to a proper plugin to add an attribute to a serializer.

9 个赞