Skip to main content

DataDrivenNamespaceInterface

\Benecaster\Feed\Namespaces\DataDrivenNamespaceInterface

Interface Free

Opt-in extension for namespace handlers that render from the filtered benecaster_feed_channel_data / benecaster_feed_episode_data arrays instead of reading show and episode meta themselves. Extends FeedNamespaceInterface.

This is what makes those two filters authoritative. A handler like ItunesNamespace that rebuilt its own data from meta would ignore a callback changing a key such as artwork, author, category, or new_feed_url — <itunes:image> would ignore the filter while the plain RSS <image> obeyed it. A handler that renders a tag some key of those arrays describes must implement this interface, or the key is decorative.

The flow, per channel and per item, in FeedCompiler: (1) Benecaster builds its array; (2) each implementer’s channel_data() / episode_data() is merged in with += — Benecaster’s keys win on a collision, so a handler adds keys but can never silently redefine one Benecaster already documents; (3) the filter runs once, with $tier_slug; (4) the implementer renders from the filtered array.

Additive, like the tier-aware interfaces: a handler registered through benecaster_feed_namespaces without it keeps its channel_tags() / episode_tags() path untouched. The FeedNamespaceInterface methods an implementer still carries must produce the same output as rendering its own unfiltered data, for callers outside the compiler.

Methods

Method Visibility Since Description
channel_data( int $show_id, string $tier_slug ): array Public — Channel keys this handler renders, as the given tier sees them.
render_channel( array $channel_data, int $show_id ): array Public — Channel-level XML fragments built from the filtered channel data array.
episode_data( int $episode_id, int $show_id, string $tier_slug ): array Public — Episode keys this handler renders, as the given tier sees them.
render_episode( array $episode_data, int $episode_id, int $show_id ): array Public — Episode-level XML fragments built from the filtered episode data array.