Clanbite Social Kit Since 1.6.2 Updated in 1.6.4
register_object_type( string $object_type, array $args ): boolRegister a reactable object type.
public static
Class: Kernowdev\ClanbiteSocialKit\Social\Reactions
Parameters
$object_type(string) RequiredLowercase slug (
a-z0-9_-), unique per kind of thing, e.g.forum_topic.$args(array<string, mixed>) RequiredDefinition.
$labelstringReadable name.$togglecallable( int $id, int $user_id, string $slug ): arraystores the reaction and returns the new state (active,reaction_type,reactions_count,reactions_by_type,user_reactions). Required.$existscallable( int $id ): boolwhether the object exists. Optional (default: assume it does).$can_reactcallable( int $id, int $user_id, string $slug ): bool|WP_Errorwhether this user may react. Return aWP_Errorto explain a refusal. Optional (default: any signed-in user).$can_viewcallable( int $id, int $user_id ): bool|WP_Errorwhether this user may see the object, so the "See all" list of who reacted is only given to people who can see it. Optional (default: anyone).$enabledcallable(): boolwhether this kind of object currently allows reactions (a settings switch). Optional (default: Social Kit's "Social reactions" setting).$reactorscallable( int $id, int $per_slug ): arraywho reacted, asslug => list<user id>, for the reactor stacks in tooltips. Optional (default: none shown).$authorcallable( int $user_id ): arrayhow a reactor is described to the browser (id,name,profile_url,avatar_url…). Optional (default:Reactions::default_author()).$typescallable(): arrayreaction types usable on this object. Optional (default: the shared registry,Reaction_Registry::get_types()).$key_prefixstringPrefix of the tooltip key the UI uses per reaction ({prefix}{id}-{slug}), unique per type on one page, e.g.tfor forum topics. Optional.
Returns
bool True when registered.
Defined in inc/Social/Reactions.php
Changelog
| Version | Description |
|---|---|
| 1.6.4 | Updated. |
| 1.6.2 | Introduced. |