Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion extensions/blocks/podcast-player/podcast-player.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function register_block() {
/**
* Podcast Player block registration/dependency declaration.
*
* @param array $attributes Array containing the Podcast Player block attributes.
* @param array|WP_Block $attributes Podcast Player block attributes / WP_Block instance.
* @return string
*/
function render_block( $attributes ) {
Expand All @@ -79,6 +79,18 @@ function render_block( $attributes ) {
return '<p>' . esc_html( $player_data->get_error_message() ) . '</p>';
}

/*
* Get the block attributes checking if `$attributes`
* is an array and it has defined a property.
*
* It handles the dual-behavior of argument
* of the callback_render() function, which
* was recently introduced by this Pull Request:
* https://github.com/WordPress/gutenberg/pull/21467
*/
if ( ! empty( $attributes->attributes ) ) {
$attributes = $attributes->attributes;
}
return render_player( $player_data, $attributes );
}

Expand Down