# gutenberg/8.5.1/build/block-library/blocks/cover.php

Gutenberg, version 8.5.1. 36 lines.

- Page: https://pluginprobe.com/plugins/gutenberg/8.5.1/code/build/block-library/blocks/cover.php
- Raw: https://pluginprobe.com/plugins/gutenberg/8.5.1/raw/build/block-library/blocks/cover.php
- Modified: 2020-05-27T16:27:08+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/gutenberg/8.5.1/code/build/block-library/blocks/cover.php#L10-L20`.

```php
<?php
/**
 * Server-side rendering of the `core/cover` block.
 *
 * @package WordPress
 */

/**
 * Supports `playsinline` attribute server side for `core/cover`.
 *
 * @param array  $attributes The block attributes.
 * @param string $content HTML content of the block.
 *
 * @return string Rendered HTML of the referenced block.
 */
function gutenberg_render_block_core_cover( $attributes, $content ) {
	if ( isset( $attributes['backgroundType'] ) && 'video' === $attributes['backgroundType'] ) {
		return str_replace( 'autoplay muted', 'autoplay muted playsinline', $content );
	}

	return $content;
}

/**
 * Registers the `core/cover` block.
 */
function gutenberg_register_block_core_cover() {
	register_block_type_from_metadata(
		__DIR__ . '/cover',
		array(
			'render_callback' => 'gutenberg_render_block_core_cover',
		)
	);
}
add_action( 'init', 'gutenberg_register_block_core_cover', 20 );

```
