Read or change which Workbench tiles a show draws, and run code when a show saves its choice
A show’s Workflow settings tab turns each Workbench tile on or off for that show (tiles are described in Put a tile on the Podcast Workflow Workbench, and say where it stands for each episode); every episode of the show draws the same tiles. A show stores only what differs from each tile’s default_on, in the show’s post meta _benecaster_workflow_tiles (a JSON object { tile_id: true|false }). So a tile declared later appears at its own default, and removing the key puts every tile back to its default.
GET /benecaster-podcast-workflow/v1/shows/{show_id}/workflow-settingsanswers{ tiles: [ { id, label, stage, description, default_on, on, add_on, partner_active } ] }, every tile in canvas order.onis whether the show draws it;partner_activeis false when the tile’sadd_onis off for the show.PUT …/workflow-settingssends{ tiles: { tile_id: true|false } }. Send every tile: one left out goes back to its default. An unknown id is ignored; any value buttrueorfalseis400 benecaster_podcast_workflow_invalid_tile_settings. It answers asGETdoes.- Both routes need
benecaster_rest_permission_admin, then refuse with404 benecaster_podcast_workflow_show_not_foundor403 benecaster_podcast_workflow_off_for_show. - benecaster_podcast_workflow_before_save_tile_settings and benecaster_podcast_workflow_after_save_tile_settings are actions,
( int $show_id, array $tiles ), around the save,$tilesbeing what is stored (only the differences from the defaults).
Code
<?php
add_action( 'benecaster_podcast_workflow_after_save_tile_settings', function ( int $show_id, array $tiles ): void {
if ( false === ( $tiles['chapter-markers'] ?? null ) ) {
my_plugin_stop_suggesting_chapters( $show_id );
}
}, 10, 2 );
Hooks Used
Need this built rather than just documented? See our services →