Clanbite Social Kit

class Feed_Context_Registry

Where every feed context lives, bundled or third-party.

Third-party plugins add a context on the clanbite_social_kit_register_feed_contexts action:

add_action( 'clanbite_social_kit_register_feed_contexts', function () { \Kernowdev\ClanbiteSocialKit\Social\Feed_Context_Registry::register( 'clan_clips', array( 'label' => __( 'Clan clips', 'my-plugin' ), 'subject' => 'number', 'query' => 'my_plugin_query_clips', ) ); } );

Once registered, the context works as a block attribute value (feedContext), is offered in the block editor, is served over REST at /clanbite-social-kit/v1/feeds/{slug}/{subject}/posts, and can accept posts from the composer. See Feed_Context for every option.

class final

Full name
Kernowdev\ClanbiteSocialKit\Social\Feed_Context_Registry

Constants

NameValueDescription
BUILT_INarray('home', 'profile', 'team', 'group')Slugs reserved for the bundled contexts; they cannot be replaced through self::register().

Methods

  • all() Every registered context, bundled first.
  • editor_config() Context list for the block editor script.
  • get_by_visibility() Registered context that stores its posts under a given visibility slug.
  • get() Look up a context.
  • has() Whether a context is registered.
  • home_post_ids() Post IDs registered feed contexts contribute to a viewer's home feed.
  • register() Register (or replace) a feed context.
  • unregister() Remove a third-party context (bundled contexts cannot be removed).

Defined in inc/Social/Feed_Context_Registry.php