Make WordPress Core


Ignore:
Timestamp:
08/11/2021 09:06:31 AM (5 years ago)
Author:
gziolo
Message:

Blocks: Add support for variations in block.json` file

We integrated variations with block types and the corresponding REST API endpoint in #52688. It's a follow-up patch to add missing support to the block.json metadata file when using register_block_type.

Some fields for variations are translatable.Therefore, i18n schema was copied over from Gutenberg: https://github.com/WordPress/gutenberg/blob/trunk/packages/blocks/src/api/i18n-block.json. The accompanying implementation was adapted as translate_settings_using_i18n_schema.

Props: gwwar, swissspidy, schlessera, jorgefilipecosta.
Fixes #53238.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/data/blocks/notice/block.json

    r51501 r51599  
    4242        }
    4343    ],
     44    "variations": [
     45        {
     46            "name": "error",
     47            "title": "Error",
     48            "description": "Shows error.",
     49            "keywords": [ "failure" ]
     50        }
     51    ],
    4452    "example": {
    4553        "attributes": {
Note: See TracChangeset for help on using the changeset viewer.