array( $this, 'render' ), ) ); } /** * Render. * * @param array $attributes Block attributes. * @return string */ public function render( $attributes ) { $player_id = isset( $attributes['playerId'] ) ? absint( $attributes['playerId'] ) : 0; if ( ! $player_id ) { return current_user_can( 'edit_posts' ) ? '
' . esc_html__( 'StreamSera: choose a player in the block settings.', 'streamsera' ) . '
' : ''; } $wrapper = get_block_wrapper_attributes( array( 'class' => 'wp-block-streamsera-player' ) ); $html = Assets::render_player( $player_id, array( 'layout' => isset( $attributes['layout'] ) ? sanitize_key( $attributes['layout'] ) : '', ) ); return '
' . wp_kses( $html, streamsera_allowed_html() ) . '
'; } }