assets = $assets; $this->story = $story; $this->context = $context; } /** * Renders the block output in default context. * * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * * @since 1.0.0 * * @param array $args Array of Argument to render. * @return string Rendered block type output. */ public function render( array $args = [] ): string { $defaults = [ 'align' => 'none', 'class' => 'wp-block-web-stories-embed', 'height' => 600, 'width' => 360, ]; $args = wp_parse_args( $args, $defaults ); $align = sprintf( 'align%s', $args['align'] ); $class = $args['class']; $url = $this->story->get_url(); $title = $this->story->get_title(); $poster = $this->story->get_poster_portrait(); $poster_srcset = $this->story->get_poster_srcset(); $poster_sizes = $this->story->get_poster_sizes(); $wrapper_style = sprintf( '--aspect-ratio: %F; --width: %dpx; --height: %dpx', 0 !== $args['height'] ? $args['width'] / $args['height'] : 1, (int) $args['width'], (int) $args['height'] ); // This CSS is used for AMP and non-AMP. $this->assets->enqueue_style_asset( Embed_Base::SCRIPT_HANDLE ); if ( $this->context->is_amp() ) { ob_start(); ?>
">
assets->enqueue_style( AMP_Story_Player_Assets::SCRIPT_HANDLE ); $this->assets->enqueue_script( AMP_Story_Player_Assets::SCRIPT_HANDLE ); ob_start(); ?>
">