Skip to main content

TierAwareEpisodeNamespaceInterface

\Benecaster\Feed\Namespaces\TierAwareEpisodeNamespaceInterface

Interface Free

An optional extension of FeedNamespaceInterface for a feed namespace handler whose episode-level output depends on which tier’s feed is being compiled. It is the episode-level counterpart of TierAwareFeedNamespaceInterface and adds one method, episode_tags_for_tier(). It is a public extension point: a handler added through the benecaster_feed_namespaces filter can implement it. The built-in ContentNamespace is the one built-in implementer, because a [benecaster_tier_gate] in an episode’s content cannot be resolved for <content:encoded> without knowing the tier.

When the feed compiler builds an item it asks each registered handler in turn. If the handler implements DataDrivenNamespaceInterface the compiler renders it from the filtered episode data array. Otherwise, if it implements this interface, the compiler calls episode_tags_for_tier() with the tier being compiled. Any other handler gets episode_tags(). Handlers that do not implement the interface need no change. A handler that implements both this and DataDrivenNamespaceInterface is treated as data-driven, and the compiler never calls its episode_tags_for_tier().

Methods

Method Visibility Since Description
episode_tags_for_tier( int $episode_id, int $show_id, string $tier_slug ): array Public — Returns episode-level XML fragments (string[], each a complete tag) for one episode as seen by one tier. Return an empty array to emit nothing for the episode. The tier slug is the one being compiled; for the public feed it is public.

Notes

The plain episode_tags() method must still be implemented and must answer as the public feed would. A caller that supplies no tier must never be handed output meant for a paying one. ContentNamespace does this by delegating to its tier-aware method with the public tier.

Unlike TierAwareFeedNamespaceInterface, this interface passes no list of available episode IDs, because the compiler is rendering one specific episode at a time.