Embed( $story, $this->assets, $this->context ); } return $renderer->render( $attributes ); } /** * Renders an embed with given attributes. * * @since 1.1.0 * * @param array $attributes Embed render attributes. * @return string Rendered embed output. */ public function render( array $attributes ): string { // The only mandatory attribute. if ( empty( $attributes['url'] ) && empty( $attributes['previewOnly'] ) ) { return ''; } if ( empty( $attributes['title'] ) ) { $attributes['title'] = __( 'Web Story', 'web-stories' ); } $data = [ 'title' => $attributes['title'], 'url' => $attributes['url'], 'poster_portrait' => $attributes['poster'], ]; $story = new Story( $data ); return $this->render_story( $story, $attributes ); } /** * Return an array of default attributes. * * @since 1.1.0 * * @return array Default attributes. */ protected function default_attrs(): array { $attrs = [ 'align' => 'none', 'height' => 600, 'poster' => '', 'url' => '', 'title' => '', 'width' => 360, 'previewOnly' => false, ]; /** * Filters settings passed to the web stories embed. * * @since 1.1.0 * * @param array $attrs Array of settings passed to web stories embed. */ return apply_filters( 'web_stories_embed_default_attributes', $attrs ); } }