T2 Background Media Supports
Adds custom support for background media. For supported blocks, it adds
a MediaReplacer
control to BlockControls
in the block editor and enables
authors to pick an image or video from the media library.
The selected media covers the complete block background. Authors can also
set the media focal point and add an overlay color.
Example 1: Support for your own blocks
block.json
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "t2/section",
"title": "Section",
"description": "Group your article into content sections",
"category": "design",
"supports": {
"t2BackgroundMedia": true
}
}
Example 2: Support for other blocks
You can also add support for core and external blocks in t2.json
t2.json
{
"t2/background-media": {
"blocks": [
"core/group",
"core/columns"
]
}
}