It takes the shared variations (styles.variations.variationName) and applies them to all the blocks that have the given variation registered (styles.blocks.blockType.variations.variationName). For example, given the core/paragraph and core/group blocks have registered the section-a style variation, and given the following input: { "styles": { "variations": { "section-a": { "color": { "background": "backgroundColor" } } } } } It returns the following output: { "styles": { "blocks": { "core/paragraph": { "variations": { "section-a": { "color": { "background": "backgroundColor" } } }, }, "core/group": { "variations": { "section-a": { "color": { "background": "backgroundColor" } } } } } } }
Parameters
$theme_jsonarray
A structure that follows the theme.json schema.
$valid_variationsarray
Valid block style variations.
Return
array
Theme json data with shared variation definitions unwrapped under appropriate block types.
Uses · 1
_wp_array_set()Sets an array in depth based on a path of keys.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/class-wp-theme-json.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.