assets = $assets; $this->story = $story; } /** * Renders the block output in default context. * * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * * @since 1.30.0 * * @param array $args Array of Argument to render. * @return string Rendered block type output. */ public function render( array $args = [] ): string { ++self::$instances; $this->instance_id = self::$instances; $defaults = [ 'align' => 'none', 'class' => 'wp-block-web-stories-embed', 'height' => 600, 'width' => 360, ]; $args = wp_parse_args( $args, $defaults ); $args['align'] = ! empty( $args['align'] ) ? $args['align'] : 'none'; $align = sprintf( 'align%s', $args['align'] ); $class = $args['class']; $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->assets->enqueue_style( AMP_Story_Player_Assets::SCRIPT_HANDLE ); $this->assets->enqueue_script( AMP_Story_Player_Assets::SCRIPT_HANDLE ); $this->assets->enqueue_script_asset( Renderer::LIGHTBOX_SCRIPT_HANDLE ); $this->assets->enqueue_style_asset( Embed_Base::SCRIPT_HANDLE ); ob_start(); ?>
" data-id="instance_id ); ?>">
render_story_with_poster( $args ); ?>
[ [ 'name' => 'close', 'position' => 'start', ], [ 'name' => 'skip-next', ], ], 'behavior' => [ 'autoplay' => false, ], ]; ?>
story->get_title() ); ?>
$args Array of Argument to render. */ protected function render_story_with_poster( array $args ): void { $poster_url = $this->story->get_poster_portrait(); $poster_srcset = $this->story->get_poster_srcset(); $poster_sizes = $this->story->get_poster_sizes(); if ( ! $poster_url ) { ?>
<?php echo esc_attr( $this->story->get_title() ); ?> srcset="" sizes="" loading="lazy" decoding="async" >
render_content_overlay(); } /** * Renders the content overlay markup. * * @since 1.30.0 */ protected function render_content_overlay(): void { ?>
story->get_title() ); ?>