Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks

Video::create_play_button_htmlprivateWC 1.0

Create the play button HTML with optional link.

Method of the class: Video{}

No Hooks.

Returns

String. Play button HTML.

Usage

// private - for code of main (parent) class only
$result = $this->create_play_button_html( $link_url ): string;
$link_url(string)
Optional URL to link to.
Default: ''

Video::create_play_button_html() code WC 10.4.3

private function create_play_button_html( string $link_url = '' ): string {
	$play_icon_url = $this->get_play_icon_url();

	$play_button = sprintf(
		'<img src="%s" alt="%s" style="width: 48px; height: 48px; display: inline-block;" />',
		esc_url( $play_icon_url ),
		// translators: Alt text for video play button icon.
		esc_attr( __( 'Play', 'woocommerce' ) )
	);

	// Wrap the play button in a link if URL is provided.
	if ( ! empty( $link_url ) ) {
		$play_button = sprintf(
			'<a href="%s" target="_blank" rel="noopener noreferrer nofollow" style="display: inline-block; text-decoration: none;">%s</a>',
			esc_url( $link_url ),
			$play_button
		);
	}

	return sprintf(
		'<p style="text-align: center;">%s</p>',
		$play_button
	);
}