Clanbite Social Kit Since 1.6.2

ui_state( array $def, int $object_id, array $counts, array $user_slugs, ?array $reactor_ids = null ): array{reactions_display: array<int, array<string, mixed>>, my_reaction: array<string, mixed>, liked: bool, viewer_can_react: bool}

Everything the reaction UI shows for one object: the chips with counts and reactors, the viewer's own reaction and flags.

Returned by Reactions::toggle() and used by every surface that lists objects, so a feed card and a forum post render the same data from the same builder.

public static

Class: Kernowdev\ClanbiteSocialKit\Social\Reactions

Parameters

$def (array<string, mixed>) Required

Object type definition.

$object_id (int) Required

Object ID.

$counts (array<string, int>) Required

Counts by reaction slug.

$user_slugs (string[]) Required

Reactions the viewer has on the object.

$reactor_ids (array<string, int[]>) Optional

Optional preloaded reactor IDs per slug (otherwise asked from the object type).

Default: null

Returns

array{reactions_display: array<int, array<string, mixed>>, my_reaction: array<string, mixed>, liked: bool, viewer_can_react: bool}

Defined in inc/Social/Reactions.php

Changelog

VersionDescription
1.6.2Introduced.